we are using cucumber JS with sync-reqest to do headless end to end testing of our web app. Each scenario has its own x-correlation-id which is set as one of each call's headers - which makes it easier using kibana to track all the logs issued for each scenario. We save three types of log from cucumber - a pretty, a json and all the console.log messages saved to file. Using this

cucumber-js.cmd -f json:results\cucumber-results.json -f pretty:results\cucumber-results-pretty.txt > results\cucumber-console.log

The correlation ID is saved to the cucumber-console.log but as we log a lot of stuff to this file, and the file can take a while to arrive in the jenkins build artifacts I would like to add that to the pretty results along with the assertion failure. the pretty results are output to the jenkins log when the test run has finished (which is then followed by the UI tests). I am trying to understand the hooks but the information out there is either easy to understand and ruby or scarce and JS.

  • If you are asking how to send a console message to stdout,stderr, or error then take a look here Commented Nov 18, 2016 at 21:24

1 Answer 1


What you are looking for is a step result hook. (using < 2.x)

this.StepResult(function(stepResult) { //step = stepResult.getStep(); //step.getName()) - gets the step that got executed //stepResult.getStatus() - gets the step status - passed || failed || skipped });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.