Search in sources :

Example 51 with Description

use of org.junit.runner.Description in project serenity-jbehave by serenity-bdd.

the class JUnitDescriptionGenerator method addCompositeSteps.

private void addCompositeSteps(Description description, String stringStep, StepCandidate step) {
    Description testDescription = Description.createSuiteDescription(getJunitSafeString(stringStep));
    addSteps(testDescription, Arrays.asList(step.composedSteps()));
    description.addChild(testDescription);
}
Also used : Description(org.junit.runner.Description)

Example 52 with Description

use of org.junit.runner.Description in project serenity-jbehave by serenity-bdd.

the class JUnitDescriptionGenerator method insertDescriptionForExamples.

private void insertDescriptionForExamples(PerformableScenario performableScenario, Description scenarioDescription) {
    Scenario scenario = performableScenario.getScenario();
    for (ExamplePerformableScenario examplePerformableScenario : performableScenario.getExamples()) {
        Description exampleRowDescription = Description.createSuiteDescription(configuration.keywords().examplesTableRow() + " " + examplePerformableScenario.getParameters());
        scenarioDescription.addChild(exampleRowDescription);
        if (hasGivenStories(scenario)) {
            insertGivenStories(scenario, exampleRowDescription);
        }
        addScenarioSteps(ScenarioType.EXAMPLE, scenario, exampleRowDescription);
    }
}
Also used : Description(org.junit.runner.Description) ExamplePerformableScenario(org.jbehave.core.embedder.PerformableTree.ExamplePerformableScenario) PerformableScenario(org.jbehave.core.embedder.PerformableTree.PerformableScenario) Scenario(org.jbehave.core.model.Scenario) ExamplePerformableScenario(org.jbehave.core.embedder.PerformableTree.ExamplePerformableScenario)

Example 53 with Description

use of org.junit.runner.Description in project junit5 by junit-team.

the class JUnitPlatformRunnerListener method executionFinished.

@Override
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
    Description description = findJUnit4Description(testIdentifier);
    Status status = testExecutionResult.getStatus();
    if (status == ABORTED) {
        this.notifier.fireTestAssumptionFailed(toFailure(testExecutionResult, description));
    } else if (status == FAILED) {
        this.notifier.fireTestFailure(toFailure(testExecutionResult, description));
    }
    if (description.isTest()) {
        this.notifier.fireTestFinished(description);
    }
}
Also used : Status(org.junit.platform.engine.TestExecutionResult.Status) Description(org.junit.runner.Description)

Example 54 with Description

use of org.junit.runner.Description in project junit5 by junit-team.

the class JUnitPlatformTestTree method generateSuiteDescription.

private Description generateSuiteDescription(TestPlan testPlan, Class<?> testClass) {
    String displayName = useTechnicalNames(testClass) ? testClass.getName() : getSuiteDisplayName(testClass);
    Description suiteDescription = Description.createSuiteDescription(displayName);
    buildDescriptionTree(suiteDescription, testPlan);
    return suiteDescription;
}
Also used : Description(org.junit.runner.Description)

Example 55 with Description

use of org.junit.runner.Description in project junit5 by junit-team.

the class JUnitPlatformTestTree method buildDescription.

private void buildDescription(TestIdentifier identifier, Description parent, TestPlan testPlan) {
    Description newDescription = createJUnit4Description(identifier, testPlan);
    parent.addChild(newDescription);
    this.descriptions.put(identifier, newDescription);
    testPlan.getChildren(identifier).forEach(testIdentifier -> buildDescription(testIdentifier, newDescription, testPlan));
}
Also used : Description(org.junit.runner.Description)

Aggregations

Description (org.junit.runner.Description)309 Test (org.junit.Test)119 Failure (org.junit.runner.notification.Failure)57 Result (org.junit.runner.Result)32 ArrayList (java.util.ArrayList)25 RunListener (org.junit.runner.notification.RunListener)23 IOException (java.io.IOException)22 Request (org.junit.runner.Request)21 Method (java.lang.reflect.Method)18 JUnitCore (org.junit.runner.JUnitCore)17 Test (org.junit.jupiter.api.Test)14 Filter (org.junit.runner.manipulation.Filter)14 File (java.io.File)13 Runner (org.junit.runner.Runner)13 Statement (org.junit.runners.model.Statement)13 LoggingListener (org.elasticsearch.test.junit.listeners.LoggingListener)12 RunNotifier (org.junit.runner.notification.RunNotifier)12 JUnit4TestListener (com.intellij.junit4.JUnit4TestListener)10 ComparisonFailure (org.junit.ComparisonFailure)10 Description.createTestDescription (org.junit.runner.Description.createTestDescription)9