Returns a single testcase for each app to launch
final TestSuite suite = new TestSuite(SUITE_NAME);
final PackageManager pm = getTargetContext().getPackageManager();
final List<ResolveInfo> apps = ProcessErrorsTest.getLauncherActivities(pm);
final TestCase setupTest = new ProcessErrorsTest() {
@Override
public void runTest() throws Exception {
testSetUpConditions();
}
};
setupTest.setName("testSetUpConditions");
suite.addTest(setupTest);
final TestCase postBootTest = new ProcessErrorsTest() {
@Override
public void runTest() throws Exception {
testNoProcessErrorsAfterBoot();
}
};
postBootTest.setName("testNoProcessErrorsAfterBoot");
suite.addTest(postBootTest);
for (final ResolveInfo app : apps) {
final TestCase appTest = new ProcessErrorsTest() {
@Override
public void runTest() throws Exception {
final Set<ProcessError> errSet = new HashSet<ProcessError>();
final Collection<ProcessError> errProcs = runOneActivity(app);
if (errProcs != null) {
errSet.addAll(errProcs);
}
if (!errSet.isEmpty()) {
fail(String.format("Got %d errors:\n%s", errSet.size(),
reportWrappedListContents(errSet)));
}
}
};
appTest.setName(app.activityInfo.name);
suite.addTest(appTest);
}
final TestCase asyncErrorTest = new ProcessErrorsTest() {
@Override
public void runTest() throws Exception {
testZZReportAsyncErrors();
}
};
asyncErrorTest.setName("testAsynchronousErrors");
suite.addTest(asyncErrorTest);
return suite;