Search in sources :

Example 86 with Test

use of junit.framework.Test in project android_frameworks_base by DirtyUnicorns.

the class TestCaseUtilTest method testCreateTestForTestCase.

public void testCreateTestForTestCase() throws Exception {
    Test test = TestCaseUtil.createTestSuite(OneTestTestCase.class);
    assertEquals(1, test.countTestCases());
}
Also used : Test(junit.framework.Test)

Example 87 with Test

use of junit.framework.Test in project android_frameworks_base by DirtyUnicorns.

the class TestCaseUtilTest method testCreateTestForTestCaseWithSuiteMethod.

public void testCreateTestForTestCaseWithSuiteMethod() throws Exception {
    Test test = TestCaseUtil.createTestSuite(OneTestTestCaseWithSuite.class);
    assertEquals(1, test.countTestCases());
}
Also used : Test(junit.framework.Test)

Example 88 with Test

use of junit.framework.Test in project android_frameworks_base by DirtyUnicorns.

the class TestCaseUtilTest method testCreateTestForTestSuiteWithSuiteMethod.

public void testCreateTestForTestSuiteWithSuiteMethod() throws Exception {
    Test test = TestCaseUtil.createTestSuite(TwoTestsInTestSuite.class);
    assertEquals(2, test.countTestCases());
}
Also used : Test(junit.framework.Test)

Example 89 with Test

use of junit.framework.Test in project android_frameworks_base by DirtyUnicorns.

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 90 with Test

use of junit.framework.Test in project intellij-community by JetBrains.

the class TestAllInPackage2 method skipSuiteComponents.

private static void skipSuiteComponents(Set allNames, Test suite) {
    if (suite instanceof TestRunnerUtil.SuiteMethodWrapper) {
        final Test test = ((TestRunnerUtil.SuiteMethodWrapper) suite).getSuite();
        final String currentSuiteName = ((TestRunnerUtil.SuiteMethodWrapper) suite).getClassName();
        skipSubtests(allNames, test, currentSuiteName);
    }
}
Also used : Test(junit.framework.Test)

Aggregations

Test (junit.framework.Test)114 TestSuite (junit.framework.TestSuite)45 TestCase (junit.framework.TestCase)22 ArrayList (java.util.ArrayList)13 InvocationTargetException (java.lang.reflect.InvocationTargetException)12 Method (java.lang.reflect.Method)12 AssertionFailedError (junit.framework.AssertionFailedError)12 TestListener (junit.framework.TestListener)11 TestResult (junit.framework.TestResult)11 TestDescriptor (android.test.suitebuilder.ListTestCaseNames.TestDescriptor)10 SmallTest (android.test.suitebuilder.annotation.SmallTest)10 Enumeration (java.util.Enumeration)10 RepeatedTest (junit.extensions.RepeatedTest)7 AndroidTestRunner (android.test.AndroidTestRunner)5 Field (java.lang.reflect.Field)5 List (java.util.List)5 IOException (java.io.IOException)3 PrintWriter (java.io.PrintWriter)2 JUnit4TestAdapter (junit.framework.JUnit4TestAdapter)2 GridAbstractTest (org.apache.ignite.testframework.junits.GridAbstractTest)2