Forum Discussion

matobinder's avatar
matobinder
Visitor
5 years ago

Having logging statements go to cucumber logs "outside of step definitions"

Using Ruby 2.6.5 with cucumber 5.1.0

So in my `features/step_definitons` files, I have a number of  "log('something')" lines.

Some of the step_defintions called other required rb file, which can't use log(undefined) so they use puts

Now, log works in the step definitions just fine.
In my external code it calls, I have been using puts.

This is all fine, but we have an automated testing system that does something like
"cucumber --format message --out test_results"

The trouble is, my external code that is using the puts doesn't go into that "--out test_results" file, it goes to the console of the tool that is running the automated tests.

Is there some way I can get at that logging object that cucumber has inside the step definitions, the one I get when using "log" (NOTE: I used to use puts there too, but started getting that WARNing of deprecation to use puts instead)

No RepliesBe the first to reply