use of org.junit.internal.runners.model.EachTestNotifier in project drools by kiegroup.
the class ScenarioRunner4JUnit method runScenario.
private void runScenario(RunNotifier notifier, Scenario scenario) {
Description childDescription = Description.createTestDescription(getClass(), scenario.getName());
descr.addChild(childDescription);
EachTestNotifier eachNotifier = new EachTestNotifier(notifier, childDescription);
try {
eachNotifier.fireTestStarted();
// If a KieSession is not available, fail fast
if (ksessions == null || ksessions.values().isEmpty()) {
eachNotifier.addFailure(new NullKieSessionException("Unable to get a Session to run tests. Check the project for build errors."));
} else {
KieSession ksession = getKSession(scenario.getKSessions());
if (ksession == null) {
String ksessionName = getKSessionName(scenario.getKSessions());
if (ksessionName == null) {
eachNotifier.addFailure(new NullPointerException("Test scenario runner could not find the default knowledge session."));
} else {
eachNotifier.addFailure(new NullPointerException("Test Scenarios require Stateful KieSession to run."));
}
} else {
final ScenarioRunner runner = new ScenarioRunner(ksession, maxRuleFirings);
runner.run(scenario);
if (!scenario.wasSuccessful()) {
StringBuilder builder = new StringBuilder();
for (String message : scenario.getFailureMessages()) {
builder.append(message).append("\n");
}
eachNotifier.addFailedAssumption(new AssumptionViolatedException(builder.toString()));
}
// FLUSSSSSH!
for (FactHandle factHandle : ksession.getFactHandles()) {
ksession.delete(factHandle);
}
resetKieSession(ksession);
}
}
} catch (Throwable t) {
eachNotifier.addFailure(t);
} finally {
// has to always be called as per junit docs
eachNotifier.fireTestFinished();
}
}
use of org.junit.internal.runners.model.EachTestNotifier in project JikesRVM by JikesRVM.
the class VMRequirements method ignoreTest.
private void ignoreTest(FrameworkMethod method, RunNotifier notifier, Description description) {
EachTestNotifier eachTestNotifier = new EachTestNotifier(notifier, description);
eachTestNotifier.fireTestIgnored();
}
use of org.junit.internal.runners.model.EachTestNotifier in project devonfw-testing by devonfw.
the class ParallelTestClassRunner method run.
@Override
public void run(final RunNotifier notifier) {
EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription());
try {
Statement statement = classBlock(notifier);
statement.evaluate();
} catch (AssumptionViolatedException e) {
testNotifier.addFailedAssumption(e);
} catch (StoppedByUserException e) {
throw e;
} catch (Throwable e) {
testNotifier.addFailure(e);
} finally {
}
}
use of org.junit.internal.runners.model.EachTestNotifier in project flink by apache.
the class FlinkEmbeddedHiveRunner method runChild.
@Override
protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
Description description = describeChild(method);
if (method.getAnnotation(Ignore.class) != null) {
notifier.fireTestIgnored(description);
} else {
EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
eachNotifier.fireTestStarted();
try {
runTestMethod(method, eachNotifier);
} finally {
eachNotifier.fireTestFinished();
}
}
}
use of org.junit.internal.runners.model.EachTestNotifier in project hive by apache.
the class RetryTestRunner method runTestUnit.
private void runTestUnit(final Statement statement, final Description description, final RunNotifier notifier) {
final EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
eachNotifier.fireTestStarted();
try {
statement.evaluate();
} catch (AssumptionViolatedException e) {
eachNotifier.addFailedAssumption(e);
} catch (Throwable e) {
retry(description, eachNotifier, statement, e);
} finally {
eachNotifier.fireTestFinished();
}
}
Aggregations