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


Java Feature.getName方法代码示例

本文整理汇总了Java中gherkin.ast.Feature.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Feature.getName方法的具体用法?Java Feature.getName怎么用?Java Feature.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gherkin.ast.Feature的用法示例。


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

示例1: parse

import gherkin.ast.Feature; //导入方法依赖的package包/类
public void parse(File file) {
    if (file != null && file.exists()) {
        try {
            Feature feature = GHERKIN_PARSER.parse(new FileReader(file)).getFeature();
            String featureName = feature.getName();
            createTestCases(updateInfo(create(featureName), feature),
                    feature);
            File tp = new File(sMainFrame.getProject().getLocation(), "TestPlan");
            Files.copy(file, new File(tp, file.getName()));
        } catch (Exception ex) {
            Logger.getLogger(BddParser.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:15,代码来源:BddParser.java

示例2: getSingleScenariosFromFeature

import gherkin.ast.Feature; //导入方法依赖的package包/类
/**
 * Returns a {@link com.trivago.rta.vo.SingleScenario} list from a given feature file.
 *
 * @param featureContent      a feature string.
 * @param scenarioLineNumber  an optional line number of a scenario inside a feature file.
 * @param includeScenarioTags optional scenario tags to include into scenario generation.
 * @param excludeScenarioTags optional scenario tags to exclude from scenario generation.
 * @return a {@link com.trivago.rta.vo.SingleScenario} list.
 * @throws CucablePluginException see {@link CucablePluginException}.
 */
public List<SingleScenario> getSingleScenariosFromFeature(
        final String featureContent,
        final Integer scenarioLineNumber,
        final List<String> includeScenarioTags,
        final List<String> excludeScenarioTags) throws CucablePluginException {

    GherkinDocument gherkinDocument = getGherkinDocumentFromFeatureFileContent(featureContent);

    Feature feature = gherkinDocument.getFeature();
    String featureName = feature.getName();
    List<String> featureTags =
            gherkinToCucableConverter.convertGherkinTagsToCucableTags(feature.getTags());

    ArrayList<SingleScenario> singleScenarioFeatures = new ArrayList<>();
    List<Step> backgroundSteps = new ArrayList<>();

    List<ScenarioDefinition> scenarioDefinitions = feature.getChildren();
    for (ScenarioDefinition scenarioDefinition : scenarioDefinitions) {
        String scenarioName = scenarioDefinition.getName();

        if (scenarioDefinition instanceof Background) {
            // Save background steps in order to add them to every scenario inside the same feature
            Background background = (Background) scenarioDefinition;
            backgroundSteps = gherkinToCucableConverter.convertGherkinStepsToCucableSteps(background.getSteps());
            continue;
        }

        if (scenarioDefinition instanceof Scenario) {
            Scenario scenario = (Scenario) scenarioDefinition;
            if (scenarioLineNumber == null || scenario.getLocation().getLine() == scenarioLineNumber) {
                SingleScenario singleScenario =
                        new SingleScenario(featureName, scenarioName, featureTags, backgroundSteps);
                addGherkinScenarioInformationToSingleScenario(scenario, singleScenario);

                if (scenarioShouldBeIncluded(singleScenario.getScenarioTags(), singleScenario.getFeatureTags(), includeScenarioTags, excludeScenarioTags)) {
                    singleScenarioFeatures.add(singleScenario);
                }
            }
            continue;
        }

        if (scenarioDefinition instanceof ScenarioOutline) {
            ScenarioOutline scenarioOutline = (ScenarioOutline) scenarioDefinition;
            if (scenarioLineNumber == null || scenarioOutline.getLocation().getLine() == scenarioLineNumber) {
                List<SingleScenario> outlineScenarios =
                        getSingleScenariosFromOutline(
                                scenarioOutline,
                                featureName,
                                featureTags,
                                backgroundSteps,
                                includeScenarioTags,
                                excludeScenarioTags);
                singleScenarioFeatures.addAll(outlineScenarios);
            }
        }
    }
    return singleScenarioFeatures;
}
 
开发者ID:trivago,项目名称:cucable-plugin,代码行数:69,代码来源:GherkinDocumentParser.java


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