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; }
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 void printFeature(String path) { Feature feature = testSources.getFeature(path); printTags(feature.getTags()); out.println(feature.getKeyword() + ": " + feature.getName()); printDescription(feature.getDescription()); }
private String descriptionWithScenarioReferencesFrom(Feature feature) { if (feature.getDescription() == null) { return ""; } return stream(feature.getDescription().split("\\r?\\n")) .map(line -> DescriptionWithScenarioReferences.from(feature).forText(line)) .collect(Collectors.joining(lineSeparator())); }
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 Feature featureWithDefaultName(Feature feature, String defaultName) { return new Feature(feature.getTags(), feature.getLocation(), feature.getLanguage(), feature.getKeyword(), defaultName, feature.getDescription(), feature.getChildren()); }
private Feature featureWithDefaultName(Feature feature, String defaultName) { return new Feature(feature.getTags(), feature.getLocation(), feature.getLanguage(), feature.getKeyword(), defaultName, feature.getDescription(), feature.getChildren()); }
private void handleTestCaseStarted(final TestCaseStarted event) { currentFeatureFile = event.testCase.getUri(); currentFeature = cucumberSourceUtils.getFeature(currentFeatureFile); currentTestCase = event.testCase; final Deque<PickleTag> tags = new LinkedList<>(event.testCase.getTags()); final LabelBuilder labelBuilder = new LabelBuilder(currentFeature, event.testCase, tags); final String name = event.testCase.getName(); final String featureName = currentFeature.getName(); final TestResult result = new TestResult() .setUuid(getTestCaseUuid(event.testCase)) .setHistoryId(getHistoryId(event.testCase)) .setFullName(String.format("%s: %s", featureName, name)) .setName(name) .setLabels(labelBuilder.getScenarioLabels()) .setLinks(labelBuilder.getScenarioLinks()); final ScenarioDefinition scenarioDefinition = cucumberSourceUtils.getScenarioDefinition(currentFeatureFile, currentTestCase.getLine()); if (scenarioDefinition instanceof ScenarioOutline) { result.setParameters( getExamplesAsParameters((ScenarioOutline) scenarioDefinition) ); } if (currentFeature.getDescription() != null && !currentFeature.getDescription().isEmpty()) { result.setDescription(currentFeature.getDescription()); } lifecycle.scheduleTestCase(result); lifecycle.startTestCase(getTestCaseUuid(event.testCase)); }
private void handleTestCaseStarted(final TestCaseStarted event) { currentFeatureFile = event.testCase.getUri(); currentFeature = cucumberSourceUtils.getFeature(currentFeatureFile); currentTestCase = event.testCase; final Deque<PickleTag> tags = new LinkedList<>(event.testCase.getTags()); final LabelBuilder labelBuilder = new LabelBuilder(currentFeature, event.testCase, tags); final String name = event.testCase.getName(); final String featureName = currentFeature.getName(); final TestResult result = new TestResult() .setUuid(getTestCaseUuid(event.testCase)) .setHistoryId(getHistoryId(event.testCase)) .setFullName(String.format("%s: %s", featureName, name)) .setName(name) .setLabels(labelBuilder.getScenarioLabels()) .setLinks(labelBuilder.getScenarioLinks()); final ScenarioDefinition scenarioDefinition = cucumberSourceUtils.getScenarioDefinition(currentFeatureFile, currentTestCase.getLine()); if (scenarioDefinition instanceof ScenarioOutline) { result.setParameters( getExamplesAsParameters((ScenarioOutline) scenarioDefinition) ); } if (currentFeature.getDescription() != null && !currentFeature.getDescription().isEmpty()) { result.setDescription(currentFeature.getDescription()); } lifecycle.scheduleTestCase(result); lifecycle.startTestCase(getTestCaseUuid(event.testCase)); }
String featureName = feature.getKeyword() + ": " + feature.getName(); String featureLanguage = feature.getLanguage(); String featureDescription = feature.getDescription(); List<String> featureTags = gherkinToCucableConverter.convertGherkinTagsToCucableTags(feature.getTags());