Search in sources :

Example 1 with PerformableScenario

use of org.jbehave.core.embedder.PerformableTree.PerformableScenario 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 2 with PerformableScenario

use of org.jbehave.core.embedder.PerformableTree.PerformableScenario in project serenity-jbehave by serenity-bdd.

the class JUnitDescriptionGenerator method createDescriptionFrom.

public Description createDescriptionFrom(PerformableScenario performableScenario) {
    Scenario scenario = performableScenario.getScenario();
    Description scenarioDescription = createDescriptionForScenario(scenario);
    if (performableScenario.hasExamples() && !scenario.getGivenStories().requireParameters()) {
        insertDescriptionForExamples(performableScenario, scenarioDescription);
    } else {
        if (hasGivenStories(scenario)) {
            insertGivenStories(scenario, scenarioDescription);
        }
        addScenarioSteps(ScenarioType.NORMAL, scenario, scenarioDescription);
    }
    return scenarioDescription;
}
Also used : Description(org.junit.runner.Description) PerformableScenario(org.jbehave.core.embedder.PerformableTree.PerformableScenario) Scenario(org.jbehave.core.model.Scenario) ExamplePerformableScenario(org.jbehave.core.embedder.PerformableTree.ExamplePerformableScenario)

Aggregations

ExamplePerformableScenario (org.jbehave.core.embedder.PerformableTree.ExamplePerformableScenario)2 PerformableScenario (org.jbehave.core.embedder.PerformableTree.PerformableScenario)2 Scenario (org.jbehave.core.model.Scenario)2 Description (org.junit.runner.Description)2