Search in sources :

Example 16 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project cucumber-jvm by cucumber.

the class JUnitReporterTest method failed_step_and_after_with_pending_exception_non_strict.

@Test
public void failed_step_and_after_with_pending_exception_non_strict() {
    createNonStrictReporter();
    createDefaultRunNotifier();
    Result stepResult = mock(Result.class);
    Throwable exception = mock(Throwable.class);
    when(stepResult.getError()).thenReturn(exception);
    Result hookResult = mock(Result.class);
    Match match = mock(Match.class);
    when(hookResult.getStatus()).thenReturn("Pending");
    when(hookResult.getError()).thenReturn(new PendingException());
    EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
    jUnitReporter.executionUnitNotifier = executionUnitNotifier;
    jUnitReporter.result(stepResult);
    jUnitReporter.after(match, hookResult);
    jUnitReporter.finishExecutionUnit();
    verify(executionUnitNotifier, times(0)).fireTestIgnored();
}
Also used : EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) PendingException(cucumber.api.PendingException) Result(gherkin.formatter.model.Result) Match(gherkin.formatter.model.Match) Test(org.junit.Test)

Example 17 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project cucumber-jvm by cucumber.

the class JUnitReporter method startExecutionUnit.

public void startExecutionUnit(ExecutionUnitRunner executionUnitRunner, RunNotifier runNotifier) {
    this.executionUnitRunner = executionUnitRunner;
    this.runNotifier = runNotifier;
    this.stepNotifier = null;
    this.failedStep = false;
    this.ignoredStep = false;
    executionUnitNotifier = new EachTestNotifier(runNotifier, executionUnitRunner.getDescription());
    executionUnitNotifier.fireTestStarted();
}
Also used : EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier)

Example 18 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project cucumber-jvm by cucumber.

the class JUnitReporter method match.

public void match(Match match) {
    Step runnerStep = fetchAndCheckRunnerStep();
    Description description = executionUnitRunner.describeChild(runnerStep);
    stepNotifier = new EachTestNotifier(runNotifier, description);
    reporter.match(match);
    if (junitOptions.allowStartedIgnored()) {
        stepNotifier.fireTestStarted();
    }
}
Also used : Description(org.junit.runner.Description) EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) Step(gherkin.formatter.model.Step)

Example 19 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project robolectric by robolectric.

the class SandboxTestRunner method runChild.

@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
    Description description = describeChild(method);
    EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
    if (shouldIgnore(method)) {
        eachNotifier.fireTestIgnored();
    } else {
        eachNotifier.fireTestStarted();
        try {
            methodBlock(method).evaluate();
        } catch (AssumptionViolatedException e) {
            eachNotifier.addFailedAssumption(e);
        } catch (Throwable e) {
            eachNotifier.addFailure(e);
        } finally {
            eachNotifier.fireTestFinished();
        }
    }
}
Also used : Description(org.junit.runner.Description) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException) EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier)

Example 20 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project sling by apache.

the class SlingRemoteTestRunner method runChild.

@Override
protected void runChild(SlingRemoteTest t, RunNotifier notifier) {
    try {
        maybeExecuteTests();
    } catch (Exception e) {
        throw new Error(e);
    }
    EachTestNotifier eachNotifier = new EachTestNotifier(notifier, t.describe());
    eachNotifier.fireTestStarted();
    try {
        log.debug("Running test {}", t.describe());
        t.run();
    } catch (AssumptionViolatedException e) {
        eachNotifier.addFailedAssumption(e);
    } catch (Throwable e) {
        eachNotifier.addFailure(e);
    } finally {
        eachNotifier.fireTestFinished();
    }
}
Also used : AssumptionViolatedException(org.junit.internal.AssumptionViolatedException) EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) InitializationError(org.junit.runners.model.InitializationError) MultipleFailureException(org.junit.internal.runners.model.MultipleFailureException) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException)

Aggregations

EachTestNotifier (org.junit.internal.runners.model.EachTestNotifier)30 AssumptionViolatedException (org.junit.internal.AssumptionViolatedException)12 Test (org.junit.Test)10 Result (gherkin.formatter.model.Result)8 Description (org.junit.runner.Description)6 PendingException (cucumber.api.PendingException)5 StoppedByUserException (org.junit.runner.notification.StoppedByUserException)5 Statement (org.junit.runners.model.Statement)4 Match (gherkin.formatter.model.Match)3 Ignore (org.junit.Ignore)2 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)1 TraceContext (com.navercorp.pinpoint.bootstrap.context.TraceContext)1 Step (gherkin.formatter.model.Step)1 ArrayList (java.util.ArrayList)1 JSONException (org.json.JSONException)1 MultipleFailureException (org.junit.internal.runners.model.MultipleFailureException)1 InitializationError (org.junit.runners.model.InitializationError)1 KieSession (org.kie.api.runtime.KieSession)1 FactHandle (org.kie.api.runtime.rule.FactHandle)1 ProviderDescription (org.mapstruct.itest.testutil.runner.xml.Toolchains.ProviderDescription)1