use of io.cucumber.messages.types.Scenario in project cucumber-jvm by cucumber.
the class JsonFormatter method createTestCase.
private Map<String, Object> createTestCase(TestCaseStarted event) {
Map<String, Object> testCaseMap = new HashMap<>();
testCaseMap.put("start_timestamp", getDateTimeFromTimeStamp(event.getInstant()));
TestCase testCase = event.getTestCase();
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));
Scenario 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<>();
for (String tag : testCase.getTags()) {
Map<String, Object> tagMap = new HashMap<>();
tagMap.put("name", tag);
tagList.add(tagMap);
}
testCaseMap.put("tags", tagList);
}
return testCaseMap;
}
use of io.cucumber.messages.types.Scenario in project cucumber-jvm by cucumber.
the class GherkinMessagesPickle method getScenarioLocation.
@Override
public Location getScenarioLocation() {
String sourceId = pickle.getAstNodeIds().get(0);
Scenario scenario = cucumberQuery.getGherkinScenario(sourceId);
io.cucumber.messages.types.Location location = scenario.getLocation();
return GherkinMessagesLocation.from(location);
}
Aggregations