Search in sources :

Example 36 with TestSuite

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

the class InstrumentationTestRunnerTest method assertTestRunnerCalledWithExpectedParameters.

private void assertTestRunnerCalledWithExpectedParameters(String expectedTestClassName, String expectedTestMethodName) {
    Test test = mStubAndroidTestRunner.getTest();
    assertContentsInOrder(ListTestCaseNames.getTestNames((TestSuite) test), new TestDescriptor(expectedTestClassName, expectedTestMethodName));
    assertTrue(mInstrumentationTestRunner.isStarted());
    assertFalse(mInstrumentationTestRunner.isFinished());
}
Also used : TestSuite(junit.framework.TestSuite) Test(junit.framework.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest) TestDescriptor(android.test.suitebuilder.ListTestCaseNames.TestDescriptor)

Example 37 with TestSuite

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

the class TestCaseUtilTest method testGetTestCaseNamesForTestSuiteWithSuiteMethod.

public void testGetTestCaseNamesForTestSuiteWithSuiteMethod() throws Exception {
    TestSuite testSuite = new TwoTestsInTestSuite();
    List<String> testCaseNames = TestCaseUtil.getTestCaseNames(testSuite, false);
    assertEquals(2, testCaseNames.size());
    assertTrue(testCaseNames.get(0).endsWith("OneTestTestCase"));
    assertTrue(testCaseNames.get(1).endsWith("OneTestTestSuite"));
}
Also used : TestSuite(junit.framework.TestSuite)

Example 38 with TestSuite

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

the class InstrumentationTestSuiteBuilderTest 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 39 with TestSuite

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

the class InstrumentationTestSuiteBuilderTest method testShouldOnlyIncludeIntrumentationTests.

public void testShouldOnlyIncludeIntrumentationTests() throws Exception {
    TestSuite testSuite = new OuterTest().buildTestsUnderHereWith(instrumentationTestSuiteBuilder);
    List<String> testCaseNames = getTestCaseNames(testSuite);
    assertEquals(1, testCaseNames.size());
    assertEquals("testInstrumentation", testCaseNames.get(0));
}
Also used : TestSuite(junit.framework.TestSuite) OuterTest(android.test.suitebuilder.examples.OuterTest)

Example 40 with TestSuite

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

the class ListTestCaseNames method getTestNames.

/** 
     * Returns a list of test class and method names for each TestCase in suite.  
     */
public static List<TestDescriptor> getTestNames(TestSuite suite) {
    List<Test> tests = Collections.<Test>list(suite.tests());
    ArrayList<TestDescriptor> testNames = new ArrayList<TestDescriptor>();
    for (Test test : tests) {
        if (test instanceof TestCase) {
            String className = test.getClass().getName();
            String testName = ((TestCase) test).getName();
            testNames.add(new TestDescriptor(className, testName));
        } else if (test instanceof TestSuite) {
            testNames.addAll(getTestNames((TestSuite) test));
        }
    }
    return testNames;
}
Also used : TestSuite(junit.framework.TestSuite) Test(junit.framework.Test) TestCase(junit.framework.TestCase) ArrayList(java.util.ArrayList)

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