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");
}
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;
}
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");
}
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;
}
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");
}
Aggregations