Search in sources :

Example 1 with Step

use of io.cucumber.messages.types.Step in project cucumber-jvm by cucumber.

the class JsonFormatter method createTestStep.

private Map<String, Object> createTestStep(PickleStepTestStep testStep) {
    Map<String, Object> stepMap = new HashMap<>();
    stepMap.put("name", testStep.getStepText());
    stepMap.put("line", testStep.getStepLine());
    TestSourcesModel.AstNode astNode = testSources.getAstNode(currentFeatureFile, testStep.getStepLine());
    StepArgument argument = testStep.getStepArgument();
    if (argument != null) {
        if (argument instanceof DocStringArgument) {
            DocStringArgument docStringArgument = (DocStringArgument) argument;
            stepMap.put("doc_string", createDocStringMap(docStringArgument));
        } else if (argument instanceof DataTableArgument) {
            DataTableArgument dataTableArgument = (DataTableArgument) argument;
            stepMap.put("rows", createDataTableList(dataTableArgument));
        }
    }
    if (astNode != null) {
        Step step = (Step) astNode.node;
        stepMap.put("keyword", step.getKeyword());
    }
    return stepMap;
}
Also used : StepArgument(io.cucumber.plugin.event.StepArgument) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) DataTableArgument(io.cucumber.plugin.event.DataTableArgument) TestStep(io.cucumber.plugin.event.TestStep) PickleStepTestStep(io.cucumber.plugin.event.PickleStepTestStep) HookTestStep(io.cucumber.plugin.event.HookTestStep) Step(io.cucumber.messages.types.Step) DocStringArgument(io.cucumber.plugin.event.DocStringArgument)

Example 2 with Step

use of io.cucumber.messages.types.Step in project cucumber-jvm by cucumber.

the class TestSourcesModel method processBackgroundDefinition.

private void processBackgroundDefinition(Map<Long, AstNode> nodeMap, Background background, AstNode currentParent) {
    AstNode childNode = new AstNode(background, currentParent);
    nodeMap.put(background.getLocation().getLine(), childNode);
    for (Step step : background.getSteps()) {
        nodeMap.put(step.getLocation().getLine(), new AstNode(step, childNode));
    }
}
Also used : Step(io.cucumber.messages.types.Step)

Example 3 with Step

use of io.cucumber.messages.types.Step in project cucumber-jvm by cucumber.

the class TestSourcesModel method processScenarioDefinition.

private void processScenarioDefinition(Map<Long, AstNode> nodeMap, Scenario child, AstNode currentParent) {
    AstNode childNode = new AstNode(child, currentParent);
    nodeMap.put(child.getLocation().getLine(), childNode);
    for (io.cucumber.messages.types.Step step : child.getSteps()) {
        nodeMap.put(step.getLocation().getLine(), new AstNode(step, childNode));
    }
    if (!child.getExamples().isEmpty()) {
        processScenarioOutlineExamples(nodeMap, child, childNode);
    }
}
Also used : Step(io.cucumber.messages.types.Step)

Example 4 with Step

use of io.cucumber.messages.types.Step in project cucumber-jvm by cucumber.

the class CucumberQuery method updateStep.

private void updateStep(List<Step> stepsList) {
    for (Step step : stepsList) {
        locationBySourceId.put(requireNonNull(step.getId()), step.getLocation());
        gherkinStepById.put(requireNonNull(step.getId()), step);
    }
}
Also used : Step(io.cucumber.messages.types.Step)

Aggregations

Step (io.cucumber.messages.types.Step)4 DataTableArgument (io.cucumber.plugin.event.DataTableArgument)1 DocStringArgument (io.cucumber.plugin.event.DocStringArgument)1 HookTestStep (io.cucumber.plugin.event.HookTestStep)1 PickleStepTestStep (io.cucumber.plugin.event.PickleStepTestStep)1 StepArgument (io.cucumber.plugin.event.StepArgument)1 TestStep (io.cucumber.plugin.event.TestStep)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1