Search in sources :

Example 1 with Scope

use of org.jbehave.core.annotations.Scope in project jbehave-core by jbehave.

the class RegexStoryParser method parseBeforeLifecycle.

private List<Steps> parseBeforeLifecycle(String lifecycleAsText) {
    List<Steps> list = new ArrayList<>();
    for (String byScope : lifecycleAsText.split(keywords.scope())) {
        byScope = byScope.trim();
        if (byScope.isEmpty())
            continue;
        Scope scope = parseScope(findScope(keywords.scope() + byScope));
        Steps steps = new Steps(scope, findSteps(startingWithNL(byScope)));
        list.add(steps);
    }
    return list;
}
Also used : Steps(org.jbehave.core.model.Lifecycle.Steps) Scope(org.jbehave.core.annotations.Scope) ArrayList(java.util.ArrayList)

Example 2 with Scope

use of org.jbehave.core.annotations.Scope in project jbehave-core by jbehave.

the class PrintStreamOutput method lifecyle.

@Override
public void lifecyle(Lifecycle lifecycle) {
    if (!lifecycle.isEmpty()) {
        print(format("lifecycleStart", "{0}\n", keywords.lifecycle()));
        if (lifecycle.hasBeforeSteps()) {
            print(format("lifecycleBeforeStart", "{0}\n", keywords.before()));
            for (Scope scope : lifecycle.getScopes()) {
                printWithScope(lifecycle.getBeforeSteps(scope), scope);
            }
            print(format("lifecycleBeforeEnd", NL));
        }
        if (lifecycle.hasAfterSteps()) {
            print(format("lifecycleAfterStart", "{0}\n", keywords.after()));
            for (Scope scope : lifecycle.getScopes()) {
                printOutcomes(lifecycle, scope);
            }
            print(format("lifecycleAfterEnd", NL));
        }
        print(format("lifecycleEnd", NL));
    }
}
Also used : Scope(org.jbehave.core.annotations.Scope)

Example 3 with Scope

use of org.jbehave.core.annotations.Scope in project jbehave-core by jbehave.

the class RegexStoryParser method parseAfterLifecycle.

private List<Steps> parseAfterLifecycle(String lifecycleAsText) {
    List<Steps> list = new ArrayList<>();
    for (String byScope : lifecycleAsText.split(keywords.scope())) {
        byScope = byScope.trim();
        if (byScope.isEmpty())
            continue;
        Scope scope = parseScope(findScope(keywords.scope() + byScope));
        for (String byOutcome : byScope.split(keywords.outcome())) {
            byOutcome = byOutcome.trim();
            if (byOutcome.isEmpty())
                continue;
            String outcomeAsText = findOutcome(byOutcome);
            String filtersAsText = findFilters(removeStart(byOutcome, outcomeAsText));
            List<String> steps = findSteps(startingWithNL(removeStart(byOutcome, filtersAsText)));
            list.add(new Steps(scope, parseOutcome(outcomeAsText), parseFilters(filtersAsText), steps));
        }
    }
    return list;
}
Also used : Steps(org.jbehave.core.model.Lifecycle.Steps) Scope(org.jbehave.core.annotations.Scope) ArrayList(java.util.ArrayList)

Aggregations

Scope (org.jbehave.core.annotations.Scope)3 ArrayList (java.util.ArrayList)2 Steps (org.jbehave.core.model.Lifecycle.Steps)2