use of junit.framework.Test in project cucumber-jvm by cucumber.
the class SanityChecker method endTest.
@Override
public void endTest(Test ended) {
try {
Test lastStarted = tests.remove(tests.size() - 1);
spaces();
out.append("END " + ended.toString()).append("\n");
if (!lastStarted.toString().equals(ended.toString())) {
out.append(INSANITY).append("\n");
String errorMessage = String.format("Started : %s\nEnded : %s\n", lastStarted, ended);
out.append(errorMessage).append("\n");
}
} catch (Exception e) {
out.append(INSANITY).append("\n");
e.printStackTrace(new PrintWriter(out));
}
}
use of junit.framework.Test in project android_frameworks_base by ParanoidAndroid.
the class InstrumentationTestRunnerTest method testMultipleTestClass.
public void testMultipleTestClass() throws Exception {
String classArg = PlaceHolderTest.class.getName() + "," + PlaceHolderTest2.class.getName();
mInstrumentationTestRunner.onCreate(createBundle(InstrumentationTestRunner.ARGUMENT_TEST_CLASS, classArg));
Test test = mStubAndroidTestRunner.getTest();
assertContentsInOrder(ListTestCaseNames.getTestNames((TestSuite) test), new TestDescriptor(PlaceHolderTest.class.getName(), "testPlaceHolder"), new TestDescriptor(PlaceHolderTest2.class.getName(), "testPlaceHolder2"));
}
use of junit.framework.Test in project android_frameworks_base by ParanoidAndroid.
the class TestCaseUtilTest method testCreateTestForTestSuiteWithSuiteMethod.
public void testCreateTestForTestSuiteWithSuiteMethod() throws Exception {
Test test = TestCaseUtil.createTestSuite(TwoTestsInTestSuite.class);
assertEquals(2, test.countTestCases());
}
use of junit.framework.Test 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.Test in project android_frameworks_base by ParanoidAndroid.
the class TestCaseUtil method getTestCaseNames.
@SuppressWarnings("unchecked")
public static List<String> getTestCaseNames(Test test, boolean flatten) {
List<Test> tests = (List<Test>) getTests(test, flatten);
List<String> testCaseNames = Lists.newArrayList();
for (Test aTest : tests) {
testCaseNames.add(getTestName(aTest));
}
return testCaseNames;
}
Aggregations