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