Search in sources :

Example 11 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project cucumber-jvm by cucumber.

the class FeatureRunnerTest method should_not_issue_notification_for_steps_by_default_two_scenarios_with_background.

@Test
void should_not_issue_notification_for_steps_by_default_two_scenarios_with_background() {
    Feature feature = TestPickleBuilder.parseFeature("path/test.feature", "" + "Feature: feature name\n" + "  Background: background\n" + "    Given step #1\n" + "  Scenario: scenario_1 name\n" + "    When step #2\n" + "    Then step #3\n" + "  Scenario: scenario_2 name\n" + "    Then step #2\n");
    RunNotifier notifier = runFeatureWithNotifier(feature, new JUnitOptions());
    InOrder order = inOrder(notifier);
    order.verify(notifier).fireTestStarted(argThat(new DescriptionMatcher("scenario_1 name(feature name)")));
    order.verify(notifier, times(1)).fireTestFailure(argThat(new FailureMatcher("scenario_1 name(feature name)")));
    order.verify(notifier).fireTestFinished(argThat(new DescriptionMatcher("scenario_1 name(feature name)")));
    order.verify(notifier).fireTestStarted(argThat(new DescriptionMatcher("scenario_2 name(feature name)")));
    order.verify(notifier, times(1)).fireTestFailure(argThat(new FailureMatcher("scenario_2 name(feature name)")));
    order.verify(notifier).fireTestFinished(argThat(new DescriptionMatcher("scenario_2 name(feature name)")));
}
Also used : RunNotifier(org.junit.runner.notification.RunNotifier) InOrder(org.mockito.InOrder) Feature(io.cucumber.core.gherkin.Feature) Test(org.junit.jupiter.api.Test)

Example 12 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project component-runtime by Talend.

the class MultiEnvironmentsRunnerTest method run.

@org.junit.jupiter.api.Test
void run() throws Throwable {
    STEPS.clear();
    new AllDefaultPossibilitiesBuilder(true).runnerForClass(TheTestModel.class).run(new RunNotifier());
    assertEquals(asList("start>E1", "test1", "test2", "stop>E1", "start>E2", "test1", "test2", "stop>E2"), STEPS);
}
Also used : AllDefaultPossibilitiesBuilder(org.junit.internal.builders.AllDefaultPossibilitiesBuilder) RunNotifier(org.junit.runner.notification.RunNotifier)

Example 13 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project junit4 by junit-team.

the class ParentRunnerTest method runTestWithParentRunner.

private CountingRunListener runTestWithParentRunner(Class<?> testClass) throws InitializationError {
    CountingRunListener listener = new CountingRunListener();
    RunNotifier runNotifier = new RunNotifier();
    runNotifier.addListener(listener);
    ParentRunner<?> runner = new BlockJUnit4ClassRunner(testClass);
    runner.run(runNotifier);
    return listener;
}
Also used : RunNotifier(org.junit.runner.notification.RunNotifier) BlockJUnit4ClassRunner(org.junit.runners.BlockJUnit4ClassRunner)

Example 14 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project junit4 by junit-team.

the class OldTestClassAdaptingListenerTest method addFailureDelegatesToNotifier.

@Test
public void addFailureDelegatesToNotifier() {
    Result result = new Result();
    RunListener listener = result.createListener();
    RunNotifier notifier = new RunNotifier();
    notifier.addFirstListener(listener);
    TestCase testCase = new TestCase() {
    };
    TestListener adaptingListener = new JUnit38ClassRunner(testCase).createAdaptingListener(notifier);
    adaptingListener.addFailure(testCase, new AssertionFailedError());
    assertEquals(1, result.getFailureCount());
}
Also used : RunNotifier(org.junit.runner.notification.RunNotifier) TestCase(junit.framework.TestCase) JUnit38ClassRunner(org.junit.internal.runners.JUnit38ClassRunner) TestListener(junit.framework.TestListener) AssertionFailedError(junit.framework.AssertionFailedError) Result(org.junit.runner.Result) RunListener(org.junit.runner.notification.RunListener) Test(org.junit.Test)

Example 15 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project junit4 by junit-team.

the class UserStopTest method createNotifier.

@Before
public void createNotifier() {
    fNotifier = new RunNotifier();
    fNotifier.pleaseStop();
}
Also used : RunNotifier(org.junit.runner.notification.RunNotifier) Before(org.junit.Before)

Aggregations

RunNotifier (org.junit.runner.notification.RunNotifier)53 Failure (org.junit.runner.notification.Failure)16 Description (org.junit.runner.Description)15 Test (org.junit.Test)14 RunListener (org.junit.runner.notification.RunListener)13 Test (org.junit.jupiter.api.Test)9 Runner (org.junit.runner.Runner)9 InOrder (org.mockito.InOrder)7 Feature (io.cucumber.core.gherkin.Feature)5 ArrayList (java.util.ArrayList)5 Before (org.junit.Before)5 Request (org.junit.runner.Request)5 Result (org.junit.runner.Result)5 ParentRunner (org.junit.runners.ParentRunner)4 HashMap (java.util.HashMap)3 Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)3 BlockJUnit4ClassRunner (org.junit.runners.BlockJUnit4ClassRunner)3 KieSession (org.kie.api.runtime.KieSession)3 Match (gherkin.formatter.model.Match)2 Scenario (gherkin.formatter.model.Scenario)2