gherkin.ast.Feature.getName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中gherkin.ast.Feature.getName()方法的一些代码示例,展示了Feature.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getName()方法的具体详情如下:
包路径:gherkin.ast.Feature
类名称:Feature
方法名:getName

Feature.getName介绍

暂无

代码示例

代码示例来源:origin: cucumber/cucumber-jvm

String getFeatureName(String uri) {
  Feature feature = getFeature(uri);
  if (feature != null) {
    return feature.getName();
  }
  return "";
}

代码示例来源:origin: cucumber/cucumber-jvm

public String getName() {
  return gherkinDocument.getFeature().getName();
}

代码示例来源:origin: cucumber/cucumber-jvm

@Override
  public String toString() {
    return "\"" + cucumberFeature.getGherkinFeature().getFeature().getName() + "\"";
  }
}

代码示例来源:origin: cucumber/cucumber-jvm

private void handleTestCaseStarted(TestCaseStarted event) {
  if (TestMethod.currentFeatureFile == null || !TestMethod.currentFeatureFile.equals(event.testCase.getUri())) {
    TestMethod.currentFeatureFile = event.testCase.getUri();
    TestMethod.previousTestCaseName = "";
    TestMethod.exampleNumber = 1;
    clazz = document.createElement("class");
    clazz.setAttribute("name", TestMethod.testSources.getFeature(event.testCase.getUri()).getName());
    test.appendChild(clazz);
  }
  root = document.createElement("test-method");
  clazz.appendChild(root);
  testMethod = new TestMethod(event.testCase);
  testMethod.start(root);
}

代码示例来源:origin: cucumber/cucumber-jvm

private Map<String, Object> createFeatureMap(TestCase testCase) {
  Map<String, Object> featureMap = new HashMap<String, Object>();
  featureMap.put("uri", testCase.getUri());
  featureMap.put("elements", new ArrayList<Map<String, Object>>());
  Feature feature = testSources.getFeature(testCase.getUri());
  if (feature != null) {
    featureMap.put("keyword", feature.getKeyword());
    featureMap.put("name", feature.getName());
    featureMap.put("description", feature.getDescription() != null ? feature.getDescription() : "");
    featureMap.put("line", feature.getLocation().getLine());
    featureMap.put("id", TestSourcesModel.convertToId(feature.getName()));
    featureMap.put("tags", feature.getTags());
  }
  return featureMap;
}

代码示例来源:origin: cucumber/cucumber-jvm

private Map<String, Object> createFeature(TestCase testCase) {
  Map<String, Object> featureMap = new HashMap<String, Object>();
  Feature feature = testSources.getFeature(testCase.getUri());
  if (feature != null) {
    featureMap.put("keyword", feature.getKeyword());
    featureMap.put("name", feature.getName());
    featureMap.put("description", feature.getDescription() != null ? feature.getDescription() : "");
    if (!feature.getTags().isEmpty()) {
      featureMap.put("tags", createTagList(feature.getTags()));
    }
  }
  return featureMap;
}

代码示例来源:origin: cucumber/cucumber-jvm

@Override
public String getName() {
  Feature feature = cucumberFeature.getGherkinFeature().getFeature();
  return feature.getKeyword() + ": " + feature.getName();
}

代码示例来源:origin: cucumber/cucumber-jvm

static String calculateId(AstNode astNode) {
  Node node = astNode.node;
  if (node instanceof ScenarioDefinition) {
    return calculateId(astNode.parent) + ";" + convertToId(((ScenarioDefinition) node).getName());
  }
  if (node instanceof ExamplesRowWrapperNode) {
    return calculateId(astNode.parent) + ";" + Integer.toString(((ExamplesRowWrapperNode) node).bodyRowIndex + 2);
  }
  if (node instanceof TableRow) {
    return calculateId(astNode.parent) + ";" + Integer.toString(1);
  }
  if (node instanceof Examples) {
    return calculateId(astNode.parent) + ";" + convertToId(((Examples) node).getName());
  }
  if (node instanceof Feature) {
    return convertToId(((Feature) node).getName());
  }
  return "";
}

代码示例来源:origin: cucumber/cucumber-jvm

private void printFeature(String path) {
  Feature feature = testSources.getFeature(path);
  printTags(feature.getTags());
  out.println(feature.getKeyword() + ": " + feature.getName());
  printDescription(feature.getDescription());
}

代码示例来源:origin: io.cucumber/cucumber-testng

@Override
  public String toString() {
    return "\"" + cucumberFeature.getGherkinFeature().getFeature().getName() + "\"";
  }
}

代码示例来源:origin: net.serenity-bdd/serenity-cucumber

private Optional<Feature> featureFrom(String featureFileUri) {
  String defaultFeatureId = new File(featureFileUri).getName().replace(".feature", "");
  String defaultFeatureName = Inflector.getInstance().humanize(defaultFeatureId);
  parseGherkinIn(featureFileUri);
  if (isEmpty(testSources.getFeatureName(featureFileUri))) {
    return Optional.empty();
  }
  Feature feature = testSources.getFeature(featureFileUri);
  if (feature.getName().isEmpty()) {
    feature = featureWithDefaultName(feature, defaultFeatureName);
  }
  return Optional.of(feature);
}

代码示例来源:origin: net.serenity-bdd/serenity-cucumber

private Story userStoryFrom(Feature feature, String featureFileUri) {
  Story userStory = Story.withIdAndPath(TestSourcesModel.convertToId(feature.getName()), feature.getName(), featureFileUri).asFeature();
  if (!isEmpty(feature.getDescription())) {
    userStory = userStory.withNarrative(feature.getDescription());
  }
  return userStory;
}

代码示例来源:origin: serenity-bdd/serenity-cucumber

private Story userStoryFrom(Feature feature, String featureFileUri) {
  Story userStory = Story.withIdAndPath(TestSourcesModel.convertToId(feature.getName()), feature.getName(), featureFileUri).asFeature();
  if (!isEmpty(feature.getDescription())) {
    userStory = userStory.withNarrative(feature.getDescription());
  }
  return userStory;
}

代码示例来源:origin: io.qameta.allure/allure-cucumber3-jvm

private String getStepUuid(final TestStep step) {
  final PickleStepTestStep pickleStep = (PickleStepTestStep) step;
  return currentFeature.getName() + getTestCaseUuid(currentTestCase)
      + pickleStep.getStepText() + pickleStep.getStepLine();
}

代码示例来源:origin: io.qameta.allure/allure-cucumber3-jvm

private String getHookStepUuid(final TestStep step) {
  final HookTestStep hookTestStep = (HookTestStep) step;
  return currentFeature.getName() + getTestCaseUuid(currentTestCase)
      + hookTestStep.getHookType().toString() + step.getCodeLocation();
}

代码示例来源:origin: serenity-bdd/serenity-cucumber

private Function<ScenarioDefinition, TestScenarioResult> scenarioToResult(CucumberFeature feature) {
  return scenarioDefinition -> {
    try {
      return new TestScenarioResult(
        feature.getGherkinFeature().getFeature().getName(),
        scenarioDefinition.getName(),
        scenarioStepCountFor(backgroundStepCountFor(feature), scenarioDefinition));
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Could not determine step count for scenario '%s'", scenarioDefinition.getDescription()), e);
    }
  };
}

代码示例来源:origin: io.qameta.allure/allure-cucumber2-jvm

private String getHookStepUuid(final TestStep step) {
  return currentFeature.getName() + getTestCaseUuid(currentTestCase)
      + step.getHookType().toString() + step.getCodeLocation();
}

代码示例来源:origin: net.serenity-bdd/serenity-model

public String inFeature(Feature feature) {
  return ReportNamer.forReportType(ReportType.HTML)
           .getNormalizedTestReportNameFor(convertToId(feature.getName()) + "_" + convertToId(scenarioName));
}

代码示例来源:origin: net.serenity-bdd/serenity-cucumber

private Function<ScenarioDefinition, TestScenarioResult> scenarioToResult(CucumberFeature feature) {
  return scenarioDefinition -> {
    try {
      return new TestScenarioResult(
        feature.getGherkinFeature().getFeature().getName(),
        scenarioDefinition.getName(),
        scenarioStepCountFor(backgroundStepCountFor(feature), scenarioDefinition));
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Could not determine step count for scenario '%s'", scenarioDefinition.getDescription()), e);
    }
  };
}

代码示例来源:origin: io.qameta.allure/allure-cucumber2-jvm

private String getStepUuid(final TestStep step) {
  return currentFeature.getName() + getTestCaseUuid(currentTestCase)
      + step.getPickleStep().getText() + step.getStepLine();
}

相关文章