use of org.junit.runner.Description in project ceylon-compiler by ceylon.
the class CeylonTestGroup method runChild.
@Override
protected void runChild(Runner method, RunNotifier notifier) {
Description description = describeChild(method);
notifier.fireTestStarted(description);
Failure failure = null;
try {
method.run(notifier);
} finally {
if (failure != null) {
notifier.fireTestFailure(failure);
}
}
notifier.fireTestFinished(description);
}
use of org.junit.runner.Description in project junit4 by junit-team.
the class JUnit4ClassRunner method invokeTestMethod.
protected void invokeTestMethod(Method method, RunNotifier notifier) {
Description description = methodDescription(method);
Object test;
try {
test = createTest();
} catch (InvocationTargetException e) {
testAborted(notifier, description, e.getCause());
return;
} catch (Exception e) {
testAborted(notifier, description, e);
return;
}
TestMethod testMethod = wrapMethod(method);
new MethodRoadie(test, testMethod, notifier, description).run();
}
use of org.junit.runner.Description in project junit4 by junit-team.
the class JUnit4ClassRunner method getDescription.
@Override
public Description getDescription() {
Description spec = Description.createSuiteDescription(getName(), classAnnotations());
List<Method> testMethods = this.testMethods;
for (Method method : testMethods) {
spec.addChild(methodDescription(method));
}
return spec;
}
use of org.junit.runner.Description in project junit4 by junit-team.
the class ParentRunnerFilteringTest method testCountClassFiltering.
@Test
public void testCountClassFiltering() throws Exception {
JUnitCore junitCore = new JUnitCore();
Request request = Request.aClass(ExampleTest.class);
CountingFilter countingFilter = new CountingFilter();
Request requestFiltered = request.filterWith(countingFilter);
Result result = junitCore.run(requestFiltered);
assertEquals(1, result.getRunCount());
assertEquals(0, result.getFailureCount());
Description desc = createTestDescription(ExampleTest.class, "test1");
assertEquals(1, countingFilter.getCount(desc));
}
use of org.junit.runner.Description in project junit4 by junit-team.
the class JUnit38ClassRunnerTest method testListener.
@Test
public void testListener() throws Exception {
JUnitCore runner = new JUnitCore();
RunListener listener = new RunListener() {
@Override
public void testStarted(Description description) {
assertEquals(Description.createTestDescription(OneTest.class, "testOne"), description);
count++;
}
};
runner.addListener(listener);
count = 0;
Result result = runner.run(OneTest.class);
assertEquals(1, count);
assertEquals(1, result.getRunCount());
}
Aggregations