Search in sources :

Example 51 with RunListener

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);
}
Also used : JUnitCore(org.junit.runner.JUnitCore) TestResultMessage(org.guvnor.common.services.shared.test.TestResultMessage) ArrayList(java.util.ArrayList) RunListener(org.junit.runner.notification.RunListener) Result(org.junit.runner.Result) TestScenarioResult(org.drools.workbench.screens.testscenario.model.TestScenarioResult) ScenarioUtil.failureToFailure(org.drools.workbench.screens.testscenario.backend.server.ScenarioUtil.failureToFailure) Failure(org.junit.runner.notification.Failure)

Aggregations

RunListener (org.junit.runner.notification.RunListener)51 Failure (org.junit.runner.notification.Failure)25 Description (org.junit.runner.Description)21 JUnitCore (org.junit.runner.JUnitCore)20 Result (org.junit.runner.Result)19 Test (org.junit.Test)18 RunNotifier (org.junit.runner.notification.RunNotifier)13 Request (org.junit.runner.Request)6 ArrayList (java.util.ArrayList)5 IOException (java.io.IOException)4 Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)3 TextListener (org.junit.internal.TextListener)3 KieSession (org.kie.api.runtime.KieSession)3 KeyManagementException (java.security.KeyManagementException)2 KeyStoreException (java.security.KeyStoreException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 UnrecoverableKeyException (java.security.UnrecoverableKeyException)2 CertificateException (java.security.cert.CertificateException)2 HashMap (java.util.HashMap)2 ScenarioUtil.failureToFailure (org.drools.workbench.screens.testscenario.backend.server.ScenarioUtil.failureToFailure)2