Change code to make e2e test run more stable.

This commit is contained in:
youtaol
2013-03-04 19:08:06 +08:00
parent e1e1932071
commit 9d2b2db01f
2 changed files with 11 additions and 3 deletions
@@ -77,7 +77,12 @@ public class DeleteTest extends ActivityInstrumentationTestCase2<TrackListActivi
String totalTracks = activityMyTracks.getResources().getQuantityString(R.plurals.tracks, 0, 0);
String directoryName = FileUtils.buildExternalDirectoryPath(EndToEndTestUtils.GPX);
String message = activityMyTracks.getString(R.string.save_error, 0, totalTracks, directoryName);
assertTrue(EndToEndTestUtils.SOLO.waitForText(message));
assertTrue(EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.external_storage_not_available), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)
|| EndToEndTestUtils.SOLO.waitForText(
activityMyTracks.getString(R.string.external_storage_not_writable), 1,
EndToEndTestUtils.SHORT_WAIT_TIME) || EndToEndTestUtils.SOLO.waitForText(message));
EndToEndTestUtils
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
}
@@ -97,7 +97,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
for (int i = 0; (System.currentTimeMillis() - startTime) < TEST_DURATION_IN_MILLISECONDS; i++) {
EndToEndTestUtils.sendGps(10, i * 10);
EndToEndTestUtils.rotateCurrentActivity();
Log.i(EndToEndTestUtils.LOG_TAG, String.format("Totate %d times in %d minutes!", i,
Log.i(EndToEndTestUtils.LOG_TAG, String.format("Totate %d times in %d minutes!", i,
(System.currentTimeMillis() - startTime) / 1000 / 60));
}
}
@@ -126,7 +126,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
}
EndToEndTestUtils.stopRecording(true);
}
/**
* Records a long track.
*/
@@ -159,6 +159,8 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
// Create one way points.
EndToEndTestUtils.sendGps(10, 10 * i);
EndToEndTestUtils.createWaypoint(i);
instrumentation.waitForIdleSync();
EndToEndTestUtils.SOLO.waitForText(trackListActivity.getString(R.string.generic_recording));
EndToEndTestUtils.pauseRecording();
EndToEndTestUtils.SOLO
@@ -170,6 +172,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
EndToEndTestUtils.SOLO.clickOnText(trackListActivity
.getString(R.string.track_detail_stats_tab));
instrumentation.waitForIdleSync();
EndToEndTestUtils.SOLO.waitForText(trackListActivity.getString(R.string.generic_paused));
EndToEndTestUtils.resumeRecording();
logStatus(++i);
}