Search in sources :

Example 41 with RunNotifier

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

the class DelegatingRunnerTest method run.

@Test
void run() throws Throwable {
    MyRunner.STEPS.clear();
    new AllDefaultPossibilitiesBuilder(true).runnerForClass(TheTestModel.class).run(new RunNotifier());
    assertEquals(asList("constructor>" + TheTestModel.class.getName(), "run"), MyRunner.STEPS);
}
Also used : AllDefaultPossibilitiesBuilder(org.junit.internal.builders.AllDefaultPossibilitiesBuilder) RunNotifier(org.junit.runner.notification.RunNotifier) Test(org.junit.jupiter.api.Test)

Example 42 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project gerrit by GerritCodeReview.

the class ConfigSuiteTest method setUp.

@Before
public void setUp() {
    notifier = new RunNotifier();
    ConfigBasedTest.setConfigBasedTestListener(configBasedTestListener);
}
Also used : RunNotifier(org.junit.runner.notification.RunNotifier) Before(org.junit.Before)

Example 43 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project ceylon-compiler by ceylon.

the class CeylonModuleRunner method makeModuleRunnerInNewJvm.

private void makeModuleRunnerInNewJvm(final ModuleSpecifier module) {
    final Description description = Description.createTestDescription(getClass(), "Run " + module.module() + " in new JVM");
    Runner runner = new Runner() {

        @Override
        public Description getDescription() {
            return description;
        }

        @Override
        public void run(RunNotifier notifier) {
            notifier.fireTestStarted(description);
            try {
                String moduleName = module.module();
                String version = Module.DEFAULT_MODULE_NAME.equals(moduleName) ? null : module.version();
                String runClass = module.runClass();
                if (runClass.isEmpty())
                    runClass = moduleName + ".run_";
                runModuleInNewJvm(moduleName, version, runClass);
            } catch (Exception x) {
                x.printStackTrace();
                notifier.fireTestFailure(new Failure(description, x));
            }
            notifier.fireTestFinished(description);
        }
    };
    children.put(runner, description);
}
Also used : Runner(org.junit.runner.Runner) ParentRunner(org.junit.runners.ParentRunner) Description(org.junit.runner.Description) RunNotifier(org.junit.runner.notification.RunNotifier) URISyntaxException(java.net.URISyntaxException) MalformedURLException(java.net.MalformedURLException) Failure(org.junit.runner.notification.Failure)

Example 44 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project ceylon-compiler by ceylon.

the class CeylonModuleRunner method createFailingTest.

void createFailingTest(List<Runner> moduleRunners, final String testName, final Exception ex) {
    final Description description = Description.createTestDescription(getClass(), testName);
    Runner runner = new Runner() {

        @Override
        public Description getDescription() {
            return description;
        }

        @Override
        public void run(RunNotifier notifier) {
            notifier.fireTestStarted(description);
            notifier.fireTestFailure(new Failure(description, ex));
            notifier.fireTestFinished(description);
        }
    };
    moduleRunners.add(runner);
}
Also used : Runner(org.junit.runner.Runner) ParentRunner(org.junit.runners.ParentRunner) Description(org.junit.runner.Description) RunNotifier(org.junit.runner.notification.RunNotifier) Failure(org.junit.runner.notification.Failure)

Example 45 with RunNotifier

use of org.junit.runner.notification.RunNotifier in project powermock by powermock.

the class PowerMockRunNotifierTest method verifyBackendRunNotifierIsProperlyNotified.

@Test
public void verifyBackendRunNotifierIsProperlyNotified() throws Exception {
    Object[] testData = retrieveSuitableTestData();
    RunNotifier backendRunNotifierMock = createMock(RunNotifier.class);
    method.invoke(backendRunNotifierMock, testData);
    replay(backendRunNotifierMock);
    method.invoke(new PowerMockRunNotifier(backendRunNotifierMock, EasyMock.<PowerMockTestNotifier, PowerMockTestNotifier>createNiceMock(PowerMockTestNotifier.class), new Method[0]), testData);
    verify(backendRunNotifierMock);
}
Also used : RunNotifier(org.junit.runner.notification.RunNotifier) Method(java.lang.reflect.Method) PowerMockTestNotifier(org.powermock.tests.utils.PowerMockTestNotifier) Test(org.junit.Test)

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