本文整理汇总了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);
}
}
}
示例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;
}