아래의 코드를 내 SetupActivity에서 살펴보십시오. 실제로 해고 된 작업이 실제로 올바르게 실행되었는지 테스트 할 수 있습니까?활동에서 해고 된 스레드/작업을 테스트하는 방법 안드로이드
예를 들어,이 라인 : 내 활동에서
new AttachChildGcmTask(app).execute(app.getChildInfo().getId());
코드 :
....
@Override
public void onClick(View v) {
if (v.getId() == R.id.btn_proceed) {
finishSetup();
}
}
private void finishSetup() {
UIUtilities.showToast(this, R.string.setup_completed, true);
final AppBipper app = (AppBipper) getApplication();
app.setSetupCompleted(true);
Log.i(TAG, "finishSetup childId: "+app.getChildInfo().getId());
new AttachChildGcmTask(app).execute(app.getChildInfo().getId());
Log.i(TAG, "download settings");
new FetchClientSettings(app).execute();
Log.i(TAG, "cancel all scheduled alarms");
ScheduledLocationsHelper helper =
ScheduledLocationsHelper.getInstance(app.getDBManager(), app);
helper.cancelAlarms();
startActivity(new Intent(this, StartupActivity.class));
finish();
}
당신이 기능을 작성하는 방법에 대해 물어 보는 (... 등등, 의도를 방송 핸들러를 사용하여) 해당 테스트 당신의
AsyncTask
클래스 내부와 그들을 어떻게 든 UI에보고가 포함/단위 테스트? –그냥 작은 코드 서식 수정을 했으므로 가로 스크롤이 없었습니다 (매우 성가신 것). –