Search in sources :

Example 6 with TestSuite

use of junit.framework.TestSuite in project android_frameworks_base by ParanoidAndroid.

the class InstrumentationTestRunnerTest method testUseSelfAsTestSuiteProviderWhenNoMetaDataOrClassArgument.

public void testUseSelfAsTestSuiteProviderWhenNoMetaDataOrClassArgument() throws Exception {
    TestSuite testSuite = new TestSuite();
    testSuite.addTestSuite(PlaceHolderTest.class);
    mInstrumentationTestRunner.setAllTestsSuite(testSuite);
    mInstrumentationTestRunner.onCreate(null);
    assertTestRunnerCalledWithExpectedParameters(PlaceHolderTest.class.getName(), "testPlaceHolder");
}
Also used : TestSuite(junit.framework.TestSuite)

Example 7 with TestSuite

use of junit.framework.TestSuite in project android_frameworks_base by ParanoidAndroid.

the class TestCaseUtil method getTests.

private static List<? extends Test> getTests(Test test, boolean flatten, Set<Class<?>> seen) {
    List<Test> testCases = Lists.newArrayList();
    if (test != null) {
        Test workingTest = null;
        /*
             * If we want to run a single TestCase method only, we must not
             * invoke the suite() method, because we will run all test methods
             * of the class then.
             */
        if (test instanceof TestCase && ((TestCase) test).getName() == null) {
            workingTest = invokeSuiteMethodIfPossible(test.getClass(), seen);
        }
        if (workingTest == null) {
            workingTest = test;
        }
        if (workingTest instanceof TestSuite) {
            TestSuite testSuite = (TestSuite) workingTest;
            Enumeration enumeration = testSuite.tests();
            while (enumeration.hasMoreElements()) {
                Test childTest = (Test) enumeration.nextElement();
                if (flatten) {
                    testCases.addAll(getTests(childTest, flatten, seen));
                } else {
                    testCases.add(childTest);
                }
            }
        } else {
            testCases.add(workingTest);
        }
    }
    return testCases;
}
Also used : Enumeration(java.util.Enumeration) TestSuite(junit.framework.TestSuite) Test(junit.framework.Test) TestCase(junit.framework.TestCase)

Example 8 with TestSuite

use of junit.framework.TestSuite in project android_frameworks_base by ParanoidAndroid.

the class TestSuiteBuilderTest method testIncludeAllPackagesUnderHere.

/**
     * This test calls {@link OuterTest#buildTestsUnderHereRecursively()} to control
     * the packages under test. The call to {@link TestSuiteBuilder#includeAllPackagesUnderHere()}
     * is made from there so that only return the example tests.
     */
public void testIncludeAllPackagesUnderHere() throws Exception {
    TestSuite testSuite = new OuterTest().buildTestsUnderHereRecursively();
    assertContentsInOrder(getTestCaseNames(testSuite), "testOuter", "testErrorOne", "testErrorTwo", "testFailOne", "testFailTwo", "testInstrumentation", "testLevel1", "testLevel2", "testAnotherOne", "testSimpleOne", "testSimpleTwo", "testNonSmoke", "testSmoke", "testSubclass", "testSuperclass", "testUnSuppressedMethod");
}
Also used : TestSuite(junit.framework.TestSuite) OuterTest(android.test.suitebuilder.examples.OuterTest)

Example 9 with TestSuite

use of junit.framework.TestSuite in project android_frameworks_base by ParanoidAndroid.

the class TestSuiteBuilderTest method runSuite.

private SuiteExecutionRecorder runSuite(TestSuiteBuilder builder) {
    TestSuite suite = builder.build();
    SuiteExecutionRecorder recorder = new SuiteExecutionRecorder();
    TestResult result = new TestResult();
    result.addListener(recorder);
    suite.run(result);
    return recorder;
}
Also used : TestSuite(junit.framework.TestSuite) TestResult(junit.framework.TestResult)

Example 10 with TestSuite

use of junit.framework.TestSuite in project android_frameworks_base by ParanoidAndroid.

the class TestSuiteBuilderTest method testExcludePackage.

public void testExcludePackage() throws Exception {
    testSuiteBuilder.includePackages(packageFor(SimpleTest.class), packageFor(Level1Test.class)).excludePackages(packageFor(Level2Test.class));
    TestSuite testSuite = testSuiteBuilder.build();
    assertContentsInOrder(getTestCaseNames(testSuite), "testLevel1", "testAnotherOne", "testSimpleOne", "testSimpleTwo");
}
Also used : Level2Test(android.test.suitebuilder.examples.nested.nested.Level2Test) TestSuite(junit.framework.TestSuite)

Aggregations

TestSuite (junit.framework.TestSuite)1380 InstrumentationTestSuite (android.test.InstrumentationTestSuite)100 Test (junit.framework.Test)63 GwtIncompatible (com.google.common.annotations.GwtIncompatible)54 JUnit4TestAdapter (junit.framework.JUnit4TestAdapter)50 TestCase (junit.framework.TestCase)48 Entry (java.util.Map.Entry)36 TestResult (junit.framework.TestResult)33 List (java.util.List)28 Set (java.util.Set)27 TestProjectSetup (org.eclipse.wst.jsdt.web.ui.tests.internal.TestProjectSetup)27 ArrayList (java.util.ArrayList)25 ListTestSuiteBuilder (com.google.common.collect.testing.ListTestSuiteBuilder)24 TestStringSetGenerator (com.google.common.collect.testing.TestStringSetGenerator)24 Map (java.util.Map)19 File (java.io.File)16 Method (java.lang.reflect.Method)16 HashSet (java.util.HashSet)13 Helpers.mapEntry (com.google.common.collect.testing.Helpers.mapEntry)12 TestStringMultisetGenerator (com.google.common.collect.testing.google.TestStringMultisetGenerator)12