Search in sources :

Example 11 with Tag

use of gherkin.formatter.model.Tag in project cucumber-jvm by cucumber.

the class JavaHookTest method does_not_match_non_matching_tags.

@Test
public void does_not_match_non_matching_tags() {
    objectFactory.setInstance(new HasHooks());
    backend.buildWorld();
    backend.addHook(BEFORE.getAnnotation(Before.class), BEFORE);
    HookDefinition before = glue.getBeforeHooks().get(0);
    assertFalse(before.matches(asList(new Tag("@bar", 0))));
}
Also used : Before(cucumber.api.java.Before) Tag(gherkin.formatter.model.Tag) HookDefinition(cucumber.runtime.HookDefinition) Test(org.junit.Test)

Example 12 with Tag

use of gherkin.formatter.model.Tag in project allure-cucumberjvm by allure-framework.

the class AllureReporter method getSeverityLevel.

private SeverityLevel getSeverityLevel(Scenario scenario) {
    SeverityLevel level = null;
    List<SeverityLevel> severityLevels = Arrays.asList(SeverityLevel.BLOCKER, SeverityLevel.CRITICAL, SeverityLevel.NORMAL, SeverityLevel.MINOR, SeverityLevel.TRIVIAL);
    for (Tag tag : scenario.getTags()) {
        Matcher matcher = SEVERITY_PATTERN.matcher(tag.getName());
        if (matcher.matches()) {
            SeverityLevel levelTmp;
            String levelString = matcher.group(1);
            try {
                levelTmp = SeverityLevel.fromValue(levelString.toLowerCase());
            } catch (IllegalArgumentException e) {
                LOG.warn(String.format("Unexpected Severity level [%s]. SeverityLevel.NORMAL will be used instead", levelString), e);
                levelTmp = SeverityLevel.NORMAL;
            }
            if (level == null || severityLevels.indexOf(levelTmp) < severityLevels.indexOf(level)) {
                level = levelTmp;
            }
        }
    }
    return level;
}
Also used : SeverityLevel(ru.yandex.qatools.allure.model.SeverityLevel) Matcher(java.util.regex.Matcher) Tag(gherkin.formatter.model.Tag)

Aggregations

Tag (gherkin.formatter.model.Tag)12 Test (org.junit.Test)9 Reporter (gherkin.formatter.Reporter)6 InOrder (org.mockito.InOrder)4 Scenario (gherkin.formatter.model.Scenario)3 Step (gherkin.formatter.model.Step)3 Before (cucumber.api.java.Before)2 Given (cucumber.api.java.en.Given)2 HookDefinition (cucumber.runtime.HookDefinition)2 Feature (gherkin.formatter.model.Feature)2 Result (gherkin.formatter.model.Result)2 ArrayList (java.util.ArrayList)2 ClasspathResourceLoader (cucumber.runtime.io.ClasspathResourceLoader)1 CucumberFeature (cucumber.runtime.model.CucumberFeature)1 CucumberScenario (cucumber.runtime.model.CucumberScenario)1 Formatter (gherkin.formatter.Formatter)1 Comment (gherkin.formatter.model.Comment)1 Examples (gherkin.formatter.model.Examples)1 ExamplesTableRow (gherkin.formatter.model.ExamplesTableRow)1 Match (gherkin.formatter.model.Match)1