use of org.junit.runner.notification.RunListener in project xtext-xtend by eclipse.
the class ParameterizedSWTBotRunner method run.
@Override
public void run(RunNotifier notifier) {
RunListener failureSpy = new ScreenshotCaptureListener();
// remove existing listeners that could be added by suite or class runners
notifier.removeListener(failureSpy);
notifier.addListener(failureSpy);
try {
super.run(notifier);
} finally {
notifier.removeListener(failureSpy);
}
}
use of org.junit.runner.notification.RunListener in project drools-wb by kiegroup.
the class ScenarioRunnerService method run.
private TestResultMessage run(final String identifier, final Path path, final ScenarioRunner4JUnit scenarioRunner) {
final List<org.guvnor.common.services.shared.test.Failure> failures = new ArrayList<org.guvnor.common.services.shared.test.Failure>();
final JUnitCore jUnitCore = new JUnitCore();
jUnitCore.addListener(new RunListener() {
@Override
public void testAssumptionFailure(Failure failure) {
failures.add(failureToFailure(path, failure));
}
});
final Result result = jUnitCore.run(scenarioRunner);
failures.addAll(failuresToFailures(path, result.getFailures()));
return new TestResultMessage(identifier, result.getRunCount(), result.getRunTime(), failures);
}
use of org.junit.runner.notification.RunListener in project squidb by yahoo.
the class SquidbTestRunner method run.
/**
* Runs the test classes that match settings in {@link #PROPERTIES_FILE_NAME}.
*
* @returns Zero if all tests pass, non-zero otherwise.
*/
public int run() {
Set<Class> classesSet = getTestClasses();
Class[] classes = classesSet.toArray(new Class[classesSet.size()]);
sortClasses(classes, sortOrder);
RunListener listener = newRunListener(outputFormat);
return run(classes, listener, out);
}
use of org.junit.runner.notification.RunListener in project nutz by nutzam.
the class AdvancedTestAll method test.
public static TestResult test(List<Request> reqs, String name, Map<Request, Method> reqMap) {
// TODO 根据order文件还原测试顺序
try {
FileWriter fw = new FileWriter("./test_order_" + name + ".txt");
for (Request request : reqs) {
fw.write(reqMap.get(request).toString());
fw.write("\n");
}
fw.flush();
fw.close();
} catch (IOException e) {
}
final TestResult result = new TestResult();
RunNotifier notifier = new RunNotifier();
notifier.addListener(new RunListener() {
public void testFailure(Failure failure) throws Exception {
result.addError(asTest(failure.getDescription()), failure.getException());
}
public void testFinished(Description description) throws Exception {
result.endTest(asTest(description));
}
public void testStarted(Description description) throws Exception {
result.startTest(asTest(description));
}
public junit.framework.Test asTest(Description description) {
return new junit.framework.Test() {
public void run(TestResult result) {
throw Lang.noImplement();
}
public int countTestCases() {
return 1;
}
};
}
});
for (Request request : reqs) {
request.getRunner().run(notifier);
}
return result;
}
use of org.junit.runner.notification.RunListener in project cucumber-jvm by cucumber.
the class CucumberTest method cucumber_can_run_features_in_parallel.
@Test
void cucumber_can_run_features_in_parallel() throws Exception {
RunNotifier notifier = new RunNotifier();
RunListener listener = Mockito.mock(RunListener.class);
notifier.addListener(listener);
ParallelComputer computer = new ParallelComputer(true, true);
Request.classes(computer, ValidEmpty.class).getRunner().run(notifier);
{
InOrder order = Mockito.inOrder(listener);
order.verify(listener).testStarted(argThat(new DescriptionMatcher("Followed by some examples #1(Feature A)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("Followed by some examples #1(Feature A)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("Followed by some examples #2(Feature A)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("Followed by some examples #2(Feature A)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("Followed by some examples #3(Feature A)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("Followed by some examples #3(Feature A)")));
}
{
InOrder order = Mockito.inOrder(listener);
order.verify(listener).testStarted(argThat(new DescriptionMatcher("A(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("A(Feature B)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("B(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("B(Feature B)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("C #1(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("C #1(Feature B)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("C #2(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("C #2(Feature B)")));
order.verify(listener).testStarted(argThat(new DescriptionMatcher("C #3(Feature B)")));
order.verify(listener).testFinished(argThat(new DescriptionMatcher("C #3(Feature B)")));
}
}
Aggregations