private String getScenarioDefinitionText(ScenarioDefinition definition) { return definition.getKeyword() + ": " + definition.getName(); }
private Map<String, Object> createTestCase(TestCase testCase) { Map<String, Object> testCaseMap = new HashMap<String, Object>(); testCaseMap.put("name", testCase.getName()); TestSourcesModel.AstNode astNode = testSources.getAstNode(currentFeatureFile, testCase.getLine()); if (astNode != null) { ScenarioDefinition scenarioDefinition = TestSourcesModel.getScenarioDefinition(astNode); testCaseMap.put("keyword", scenarioDefinition.getKeyword()); testCaseMap.put("description", scenarioDefinition.getDescription() != null ? scenarioDefinition.getDescription() : ""); } if (!testCase.getTags().isEmpty()) { List<Map<String, Object>> tagList = new ArrayList<Map<String, Object>>(); for (PickleTag tag : testCase.getTags()) { Map<String, Object> tagMap = new HashMap<String, Object>(); tagMap.put("name", tag.getName()); tagList.add(tagMap); } testCaseMap.put("tags", tagList); } return testCaseMap; }
private Map<String, Object> createTestCase(TestCase testCase) { Map<String, Object> testCaseMap = new HashMap<String, Object>(); testCaseMap.put("name", testCase.getName()); testCaseMap.put("line", testCase.getLine()); testCaseMap.put("type", "scenario"); TestSourcesModel.AstNode astNode = testSources.getAstNode(currentFeatureFile, testCase.getLine()); if (astNode != null) { testCaseMap.put("id", TestSourcesModel.calculateId(astNode)); ScenarioDefinition scenarioDefinition = TestSourcesModel.getScenarioDefinition(astNode); testCaseMap.put("keyword", scenarioDefinition.getKeyword()); testCaseMap.put("description", scenarioDefinition.getDescription() != null ? scenarioDefinition.getDescription() : ""); } testCaseMap.put("steps", new ArrayList<Map<String, Object>>()); if (!testCase.getTags().isEmpty()) { List<Map<String, Object>> tagList = new ArrayList<Map<String, Object>>(); for (PickleTag tag : testCase.getTags()) { Map<String, Object> tagMap = new HashMap<String, Object>(); tagMap.put("name", tag.getName()); tagList.add(tagMap); } testCaseMap.put("tags", tagList); } return testCaseMap; }
private void printScenarioDefinition(TestCase testCase) { ScenarioDefinition scenarioDefinition = testSources.getScenarioDefinition(currentFeatureFile, testCase.getLine()); String definitionText = scenarioDefinition.getKeyword() + ": " + testCase.getName(); calculateLocationIndentation(SCENARIO_INDENT + definitionText, testCase.getTestSteps()); String locationPadding = createPaddingToLocation(SCENARIO_INDENT, definitionText); out.println(); printPickleTags(testCase.getTags(), SCENARIO_INDENT); out.println(SCENARIO_INDENT + definitionText + locationPadding + getLocationText(currentFeatureFile, testCase.getLine())); printDescription(scenarioDefinition.getDescription()); }
private ScenarioOutcome scenarioOutcomeFrom(Feature feature, ScenarioDefinition scenarioDefinition, TestOutcomes testOutcomes) { List<TestOutcome> outcomes = testOutcomes.testOutcomesWithName(scenarioDefinition.getName()); String scenarioTitle = scenarioDefinition.getName(); TestResult result = (outcomes.isEmpty()) ? TestResult.UNDEFINED : TestResultList.overallResultFrom(outcomes.stream().map(TestOutcome::getResult).collect(Collectors.toList())); List<String> reportBadges = ReportBadges.from(outcomes, scenarioDefinition.getName()); String featureReport = new ReportNameProvider().forRequirement(feature.getName(),"feature"); List<String> renderedSteps = scenarioDefinition.getSteps().stream() .map(RenderCucumber::step) .collect(Collectors.toList()); List<String> renderedExamples = (scenarioDefinition instanceof ScenarioOutline) ? RenderCucumber.examples(((ScenarioOutline) scenarioDefinition).getExamples(), feature.getName(), scenarioDefinition.getName()) : Collections.EMPTY_LIST; int exampleCount = (scenarioDefinition instanceof ScenarioOutline) ? ((ScenarioOutline) scenarioDefinition).getExamples().stream().mapToInt(examples -> examples.getTableBody().size()).sum() : 0; return new ScenarioSummaryOutcome(scenarioTitle, scenarioDefinition.getKeyword(), result, reportBadges, scenarioDefinition.getDescription(), renderedSteps, renderedExamples, exampleCount, feature.getName(), featureReport); }
String scenarioName = scenarioDefinition.getKeyword() + ": " + scenarioDefinition.getName(); String scenarioDescription = scenarioDefinition.getDescription();