Codeception: How to print additional information to console in the AcceptanceHelper class

Created on 13 Aug 2014  Â·  5Comments  Â·  Source: Codeception/Codeception

I am implementing a custom tests methodand I can not write text message in console. I need to show in the console log the number found DOM elements. How can I display the text to the console? Thanks.

Docs

Most helpful comment

I found solution to write the message to the console in AcceptanceHelper:

$output = new \Codeception\Lib\Console\Output([]);
$output->writeln('I see NN elements');

Perhaps this is not the right way.. What do you think?

All 5 comments

I found solution to write the message to the console in AcceptanceHelper:

$output = new \Codeception\Lib\Console\Output([]);
$output->writeln('I see NN elements');

Perhaps this is not the right way.. What do you think?

There is much easier debug method. It can be called from helper as $this->debug() or anywhere using codecept_debug function.

To see the output you should run tests with --debug option

Actually, I needed a method comment):

$I->comment('⚑ A simple way to display a message to the console ☺');

Thank you for your support.

@Sorbing, thanks for a solution, I adopted it and use widely. Unlike codecept_debug, it works everywhere. :-)

Was this page helpful?
0 / 5 - 0 ratings