当前位置: 首页>>代码示例>>Java>>正文


Java Tag类代码示例

本文整理汇总了Java中gherkin.formatter.model.Tag的典型用法代码示例。如果您正苦于以下问题:Java Tag类的具体用法?Java Tag怎么用?Java Tag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Tag类属于gherkin.formatter.model包,在下文中一共展示了Tag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scenario

import gherkin.formatter.model.Tag; //导入依赖的package包/类
@Override
public void scenario( Scenario xTest )
{
    currentSection = Section.SCENARIOS;
    String tagNames = null;
    if ( xTest.getTags() != null && !xTest.getTags().isEmpty() )
    {
        tagNames = "";
        for ( Tag tagName : xTest.getTags() )
            tagNames = tagNames + tagName.getName() + ",";
        
        tagNames = tagNames.substring( 0, tagNames.length() - 1 );
    }
    
    this.currentScenario = new KeyWordTest( xTest.getName(), true, null, null, false, null, null, 0, xTest.getDescription(), tagNames, null, null, configProperties, 0, null, null, null, null, 0, 0 );

    for ( KeyWordStep xStep : backgroundSteps )
        this.currentScenario.addStep( xStep );
    scenarioList.add( currentScenario );
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:21,代码来源:XMLFormatter.java

示例2: scenarioOutline

import gherkin.formatter.model.Tag; //导入依赖的package包/类
@Override
public void scenarioOutline( ScenarioOutline xTest )
{
    
    currentSection = Section.OUTLINE;
    String tagNames = null;
    if ( xTest.getTags() != null && !xTest.getTags().isEmpty() )
    {
        tagNames = "";
        for ( Tag tagName : xTest.getTags() )
            tagNames = tagNames + tagName.getName() + ",";
        
        tagNames = tagNames.substring( 0, tagNames.length() - 1 );
    }
    
    this.currentScenario = new KeyWordTest( xTest.getName(), true, null, xTest.getName(), false, null, null, 0, xTest.getDescription(), tagNames, null, null, configProperties, 0, null, null, null, null, 0, 0 );

    for ( KeyWordStep xStep : backgroundSteps )
        this.currentScenario.addStep( xStep );

    scenarioList.add( currentScenario );
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:23,代码来源:XMLFormatter.java

示例3: getTestCaseIdAnnotation

import gherkin.formatter.model.Tag; //导入依赖的package包/类
private TestCaseId getTestCaseIdAnnotation(Scenario scenario) {
    for (Tag tag : scenario.getTags()) {
        Matcher matcher = testCaseIdPattern.matcher(tag.getName());
        if(matcher.matches()){
            final String testCaseId = matcher.group(1);
            return new TestCaseId() {
                @Override
                public String value() {
                    return testCaseId;
                }

                @Override
                public Class<TestCaseId> annotationType() {
                    return TestCaseId.class;
                }
            };
        }
    }

    return null;
}
 
开发者ID:kirlionik,项目名称:allure-cucumber-plugin,代码行数:22,代码来源:AllureReporter.java

示例4: getTestCaseIdAnnotation

import gherkin.formatter.model.Tag; //导入依赖的package包/类
private TestCaseId getTestCaseIdAnnotation(Scenario scenario) {
    for (Tag tag : scenario.getTags()) {
        Matcher matcher = TEST_CASE_ID_PATTERN.matcher(tag.getName());
        if (matcher.matches()) {
            final String testCaseId = matcher.group(1);
            return new TestCaseId() {
                @Override
                public String value() {
                    return testCaseId;
                }

                @Override
                public Class<TestCaseId> annotationType() {
                    return TestCaseId.class;
                }
            };
        }
    }

    return null;
}
 
开发者ID:allure-framework,项目名称:allure-cucumberjvm,代码行数:22,代码来源:AllureReporter.java

示例5: tagsIteration

import gherkin.formatter.model.Tag; //导入依赖的package包/类
public boolean tagsIteration(List<Tag> tags, Integer line) throws Exception {
    for (Tag tag : tags) {
        if (tag.getName().contains("@runOnEnv")) {
            if (!checkParams(getParams(tag.getName()))) {
                tags.add(new Tag("@ignore", line));
                tags.add(new Tag("@envCondition", line));
                return true;
            }
        } else if (tag.getName().contains("@skipOnEnv")) {
            if (checkParams(getParams(tag.getName()))) {
                tags.add(new Tag("@ignore", line));
                tags.add(new Tag("@envCondition", line));
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:19,代码来源:RunOnTagAspect.java

示例6: emitScenarioTags

import gherkin.formatter.model.Tag; //导入依赖的package包/类
private void emitScenarioTags(ScenarioWrapper scenario, Section section) {
    List<Tag> tagList = scenario.getTags();
    if (!tagList.isEmpty()) {
        Paragraph tags = new Paragraph("Tags: ", configuration.defaultMetaFont());
        boolean first = true;
        for (Tag tag : tagList) {
            String text = tag.getName();
            if (first) {
                first = false;
            } else {
                text = ", " + tag.getName();
            }
            tags.add(new Chunk(text, configuration.tagsFont()));
        }
        section.add(tags);
    }
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:18,代码来源:PdfEmitter.java

示例7: startOfScenarioLifeCycle

import gherkin.formatter.model.Tag; //导入依赖的package包/类
@Override
public void startOfScenarioLifeCycle(final Scenario scenario) {
    this.currentScenario = scenario;

    final Deque<Tag> tags = new LinkedList<>();
    tags.addAll(scenario.getTags());

    if (SCENARIO_OUTLINE_KEYWORDS.contains(scenario.getKeyword())) {
        synchronized (gherkinSteps) {
            gherkinSteps.clear();
        }
    } else {
        tags.addAll(currentFeature.getTags());
    }

    final LabelBuilder labelBuilder = new LabelBuilder(currentFeature, scenario, tags);


    final TestResult result = new TestResult()
            .withUuid(scenario.getId())
            .withHistoryId(StepUtils.getHistoryId(scenario.getId()))
            .withName(scenario.getName())
            .withLabels(labelBuilder.getScenarioLabels())
            .withLinks(labelBuilder.getScenarioLinks());

    if (!currentFeature.getDescription().isEmpty()) {
        result.withDescription(currentFeature.getDescription());
    }

    lifecycle.scheduleTestCase(result);
    lifecycle.startTestCase(scenario.getId());

}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:34,代码来源:AllureCucumberJvm.java

示例8: resolveTagsAndTagValues

import gherkin.formatter.model.Tag; //导入依赖的package包/类
public static void resolveTagsAndTagValues(KarateBackend backend, Set<Tag> tags) {
    if (tags.isEmpty()) {
        backend.setTagValues(Collections.emptyMap());
        backend.setTags(Collections.emptyList());
        return;
    }
    Map<String, List<String>> tagValues = new LinkedHashMap(tags.size());
    Map<String, Integer> tagKeyLines = new HashMap(tags.size());
    List<String> rawTags = new ArrayList(tags.size());
    for (Tag tag : tags) {
        Integer line = tag.getLine();
        String name = tag.getName();
        List<String> values = new ArrayList();
        if (name.startsWith("@")) {
            name = name.substring(1);
        }
        rawTags.add(name);
        Integer prevTagLine = tagKeyLines.get(name);
        if (prevTagLine != null && prevTagLine > line) {
            continue; // skip tag with same name but lower line number, 
        }
        tagKeyLines.put(name, line);
        int pos = name.indexOf('=');
        if (pos != -1) {
            if (name.length() == pos + 1) { // edge case, @foo=
                values.add("");
            } else {
                String temp = name.substring(pos + 1);
                for (String s : temp.split(",")) {
                    values.add(s);
                }
            }
            name = name.substring(0, pos);
        }
        tagValues.put(name, values);
    }
    backend.setTagValues(tagValues);
    backend.setTags(rawTags);
}
 
开发者ID:intuit,项目名称:karate,代码行数:40,代码来源:CucumberUtils.java

示例9: buildBackendWorlds

import gherkin.formatter.model.Tag; //导入依赖的package包/类
@Override
public void buildBackendWorlds(Reporter reporter, Set<Tag> tags, Scenario scenario) {
    backend.buildWorld();
    // tags only work at top-level, this does not apply to 'called' features
    CucumberUtils.resolveTagsAndTagValues(backend, tags);
    // 'karate.info' also does not apply to 'called' features
    CucumberUtils.initScenarioInfo(scenario, backend);
    scenarioResult = new CucumberScenarioImpl(reporter, tags, scenario);
}
 
开发者ID:intuit,项目名称:karate,代码行数:10,代码来源:KarateRuntime.java

示例10: FilterFormatter

import gherkin.formatter.model.Tag; //导入依赖的package包/类
public FilterFormatter(Formatter formatter, List filters) {
    this.formatter = formatter;
    this.filter = detectFilter(filters);

    featureTags = new ArrayList<Tag>();
    featureElementTags = new ArrayList<Tag>();
    examplesTags = new ArrayList<Tag>();

    featureEvents = new ArrayList<BasicStatement>();
    backgroundEvents = new ArrayList<BasicStatement>();
    featureElementEvents = new ArrayList<BasicStatement>();
    examplesEvents = new ArrayList<BasicStatement>();
}
 
开发者ID:intuit,项目名称:karate,代码行数:14,代码来源:FilterFormatter.java

示例11: replay

import gherkin.formatter.model.Tag; //导入依赖的package包/类
private void replay() {
    List<Tag> feTags = new ArrayList<Tag>(featureTags);
    feTags.addAll(featureElementTags);
    List<String> feNames = Arrays.asList(featureName, featureElementName);
    List<Range> feRanges = Arrays.asList(featureElementRange);
    boolean featureElementOk = filter.evaluate(feTags, feNames, feRanges);

    List<Tag> exTags = new ArrayList<Tag>(feTags);
    exTags.addAll(examplesTags);
    List<String> exNames = new ArrayList<String>(feNames);
    exNames.add(examplesName);
    List<Range> exRanges = new ArrayList<Range>(feRanges);
    exRanges.add(examplesRange);
    boolean examplesOk = filter.evaluate(exTags, exNames, exRanges);

    if (featureElementOk || examplesOk) {
        replayEvents(featureEvents);
        replayEvents(backgroundEvents);
        replayEvents(featureElementEvents);
        if (examplesOk) {
            replayEvents(examplesEvents);
        }
    }
    examplesEvents.clear();
    // examplesTags.clear(); **karate**
    examplesName = null;
    examplesRange = null;
}
 
开发者ID:intuit,项目名称:karate,代码行数:29,代码来源:FilterFormatter.java

示例12: getSeverityLevel

import gherkin.formatter.model.Tag; //导入依赖的package包/类
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 = severityPattern.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));
                levelTmp = SeverityLevel.NORMAL;
            }

            if(level == null || severityLevels.indexOf(levelTmp) < severityLevels.indexOf(level)){
                level = levelTmp;
            }
        }
    }
    return level;
}
 
开发者ID:kirlionik,项目名称:allure-cucumber-plugin,代码行数:28,代码来源:AllureReporter.java

示例13: getIssuesAnnotation

import gherkin.formatter.model.Tag; //导入依赖的package包/类
private Issues getIssuesAnnotation(Scenario scenario) {
    List<String> issues = new ArrayList<>();
    for (Tag tag : scenario.getTags()) {
        Matcher matcher = issuePattern.matcher(tag.getName());
        if(matcher.matches()){
            issues.add(matcher.group(1));
        }
    }
    return issues.size() > 0 ? getIssuesAnnotation(issues): null;
}
 
开发者ID:kirlionik,项目名称:allure-cucumber-plugin,代码行数:11,代码来源:AllureReporter.java

示例14: getSeverityLevel

import gherkin.formatter.model.Tag; //导入依赖的package包/类
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;
}
 
开发者ID:allure-framework,项目名称:allure-cucumberjvm,代码行数:28,代码来源:AllureReporter.java

示例15: getIssuesAnnotation

import gherkin.formatter.model.Tag; //导入依赖的package包/类
private Issues getIssuesAnnotation(Scenario scenario) {
    List<String> issues = new ArrayList<>();
    for (Tag tag : scenario.getTags()) {
        Matcher matcher = ISSUE_PATTERN.matcher(tag.getName());
        if (matcher.matches()) {
            issues.add(matcher.group(1));
        }
    }
    return !issues.isEmpty() ? getIssuesAnnotation(issues) : null;
}
 
开发者ID:allure-framework,项目名称:allure-cucumberjvm,代码行数:11,代码来源:AllureReporter.java


注:本文中的gherkin.formatter.model.Tag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。