String getFeatureName(String uri) { Feature feature = getFeature(uri); if (feature != null) { return feature.getName(); } return ""; }
public String getName() { return gherkinDocument.getFeature().getName(); }
@Override public String toString() { return "\"" + cucumberFeature.getGherkinFeature().getFeature().getName() + "\""; } }
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); }
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; }
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; }
@Override public String getName() { Feature feature = cucumberFeature.getGherkinFeature().getFeature(); return feature.getKeyword() + ": " + feature.getName(); }
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 ""; }
private void printFeature(String path) { Feature feature = testSources.getFeature(path); printTags(feature.getTags()); out.println(feature.getKeyword() + ": " + feature.getName()); printDescription(feature.getDescription()); }
@Override public String toString() { return "\"" + cucumberFeature.getGherkinFeature().getFeature().getName() + "\""; } }
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); }
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; }
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; }
private String getStepUuid(final TestStep step) { final PickleStepTestStep pickleStep = (PickleStepTestStep) step; return currentFeature.getName() + getTestCaseUuid(currentTestCase) + pickleStep.getStepText() + pickleStep.getStepLine(); }
private String getHookStepUuid(final TestStep step) { final HookTestStep hookTestStep = (HookTestStep) step; return currentFeature.getName() + getTestCaseUuid(currentTestCase) + hookTestStep.getHookType().toString() + step.getCodeLocation(); }
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); } }; }
private String getHookStepUuid(final TestStep step) { return currentFeature.getName() + getTestCaseUuid(currentTestCase) + step.getHookType().toString() + step.getCodeLocation(); }
public String inFeature(Feature feature) { return ReportNamer.forReportType(ReportType.HTML) .getNormalizedTestReportNameFor(convertToId(feature.getName()) + "_" + convertToId(scenarioName)); }
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); } }; }
private String getStepUuid(final TestStep step) { return currentFeature.getName() + getTestCaseUuid(currentTestCase) + step.getPickleStep().getText() + step.getStepLine(); }