In a vanilla cucumber, everything that is called by a call putsin the step definition is written as a "test output" and formatted accordingly, as in the following output example:
Feature: A simple thing
Scenario: A simple scenario # features/simple.feature:3
Given I do a step # features/steps/step.rb:1
This text is output with puts
As you see above, this is useful formatted in a βgoodβ output format. In JSON format, it is even written in a structured way:
"keyword": "Scenario",
"name": "A simple scenario",
"line": 3,
"description": "",
"id": "a-simple-thing;a-simple-scenario",
"type": "scenario",
"steps": [
{
"keyword": "Given ",
"name": "I do a step",
"line": 4,
"output": [
"This text is output with puts"
],
}
],
The above file is generated using a trivial function file and step definition, as shown below:
Given(/^I do a step$/) do
puts 'This text is output with puts'
end
Is there an equivalent function when implementing Cucumber steps in Java that I can use to get this output in the same way? Printing on System.outbypasses the capture mechanism, which is similar to using it STDOUT.putsin Ruby.
Cucumber-JVM, , Ruby Cucumber, JSON Cucumber-JVM "", .