FileDocCategorySizeDatePackage
SmokeTestRunner.javaAPI DocAndroid 5.1 API3367Thu Mar 12 22:22:44 GMT 2015com.android.smoketest

SmokeTestRunner

public class SmokeTestRunner extends android.test.InstrumentationTestRunner
A special test runner which does a test-start for each app in a separate testcase

Fields Summary
private static final String
SUITE_NAME
Constructors Summary
Methods Summary
public junit.framework.TestSuitegetAllTests()
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;