本文整理了Java中gherkin.ast.Feature.getLanguage()
方法的一些代码示例,展示了Feature.getLanguage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getLanguage()
方法的具体详情如下:
包路径:gherkin.ast.Feature
类名称:Feature
方法名:getLanguage
暂无
代码示例来源:origin: cucumber/cucumber-jvm
String getKeywordFromSource(String uri, int stepLine) {
Feature feature = getFeature(uri);
if (feature != null) {
TestSourceRead event = getTestSourceReadEvent(uri);
String trimmedSourceLine = event.source.split("\n")[stepLine - 1].trim();
GherkinDialect dialect = new GherkinDialectProvider(feature.getLanguage()).getDefaultDialect();
for (String keyword : dialect.getStepKeywords()) {
if (trimmedSourceLine.startsWith(keyword)) {
return keyword;
}
}
}
return "";
}
代码示例来源:origin: cucumber/cucumber-jvm
private void createFeatureStepMap(String path) {
if (!pathToSourceMap.containsKey(path)) {
return;
}
Parser<GherkinDocument> parser = new Parser<GherkinDocument>(new AstBuilder());
TokenMatcher matcher = new TokenMatcher();
try {
GherkinDocument gherkinDocument = parser.parse(pathToSourceMap.get(path), matcher);
Map<Integer, StepNode> stepMap = new HashMap<Integer, StepNode>();
StepNode initialPreviousNode = null;
for (ScenarioDefinition child : gherkinDocument.getFeature().getChildren()) {
StepNode lastStepNode = processScenarioDefinition(stepMap, initialPreviousNode, child);
if (child instanceof Background) {
initialPreviousNode = lastStepNode;
}
}
pathToStepMap.put(path, new FeatureStepMap(new GherkinDialectProvider(gherkinDocument.getFeature().getLanguage()).getDefaultDialect(), stepMap));
} catch (ParserException e) {
// Ignore exceptions
}
}
代码示例来源:origin: ru.sbtqa.tag.pagefactory/page-factory-core
static Map<ScenarioDefinition, String> cacheScenarioLanguage(List<CucumberFeature> features) {
Map<ScenarioDefinition, String> scenarioLanguageMap = new HashMap<>();
for (CucumberFeature cucumberFeature : features) {
GherkinDocument gherkinDocument = cucumberFeature.getGherkinFeature();
Feature feature = gherkinDocument.getFeature();
List<ScenarioDefinition> scenarios = feature.getChildren();
for (ScenarioDefinition scenario : scenarios) {
scenarioLanguageMap.put(scenario, feature.getLanguage());
}
}
return scenarioLanguageMap;
}
}
代码示例来源:origin: ru.sbtqa.tag/qa-utils
public static Locale getLocale(Scenario scenario) {
List<String> scenarioPaths = new ArrayList<>();
scenarioPaths.add(scenario.getUri());
MultiLoader multiLoader = new MultiLoader(ClassLoader.getSystemClassLoader());
String language = DEFAULT_LANGUAGE;
try {
CucumberFeature cucumberFeature = CucumberFeature.load(multiLoader, scenarioPaths).get(0);
language = cucumberFeature.getGherkinFeature().getFeature().getLanguage();
} catch (Exception e) {
LOG.warn("Error while reading feature with uri {}. Using default language {} as fallback", scenario.getUri(), DEFAULT_LANGUAGE, e);
}
return new Locale(language);
}
}
代码示例来源:origin: io.qameta.allure/allure-cucumber2-jvm
public String getKeywordFromSource(final String uri, final int stepLine) {
final Feature feature = getFeature(uri);
if (feature != null) {
final TestSourceRead event = getTestSourceReadEvent(uri);
final String trimmedSourceLine = event.source.split("\n")[stepLine - 1].trim();
final GherkinDialect dialect = new GherkinDialectProvider(feature.getLanguage()).getDefaultDialect();
for (String keyword : dialect.getStepKeywords()) {
if (trimmedSourceLine.startsWith(keyword)) {
return keyword;
}
}
}
return "";
}
代码示例来源:origin: io.qameta.allure/allure-cucumber3-jvm
public String getKeywordFromSource(final String uri, final int stepLine) {
final Feature feature = getFeature(uri);
if (feature != null) {
final TestSourceRead event = getTestSourceReadEvent(uri);
final String trimmedSourceLine = event.source.split("\n")[stepLine - 1].trim();
final GherkinDialect dialect = new GherkinDialectProvider(feature.getLanguage()).getDefaultDialect();
for (String keyword : dialect.getStepKeywords()) {
if (trimmedSourceLine.startsWith(keyword)) {
return keyword;
}
}
}
return "";
}
代码示例来源:origin: serenity-bdd/serenity-cucumber
private Feature featureWithDefaultName(Feature feature, String defaultName) {
return new Feature(feature.getTags(),
feature.getLocation(),
feature.getLanguage(),
feature.getKeyword(),
defaultName,
feature.getDescription(),
feature.getChildren());
}
代码示例来源:origin: net.serenity-bdd/serenity-cucumber
private Feature featureWithDefaultName(Feature feature, String defaultName) {
return new Feature(feature.getTags(),
feature.getLocation(),
feature.getLanguage(),
feature.getKeyword(),
defaultName,
feature.getDescription(),
feature.getChildren());
}
代码示例来源:origin: trivago/cucable-plugin
Feature feature = gherkinDocument.getFeature();
String featureName = feature.getKeyword() + ": " + feature.getName();
String featureLanguage = feature.getLanguage();
String featureDescription = feature.getDescription();
List<String> featureTags =
内容来源于网络,如有侵权,请联系作者删除!