2

I'm writing a test that's not working like I expect.

I need to use some grabbers and then dump to the screen while test is running.

How I can do this ? How do echo, NOT how user grabber; I'm able to use grabbers but I don't know how to echos while test is running.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
realtebo
  • 23,922
  • 37
  • 112
  • 189
  • There is no specific command to print to screen / terminal while running a test. Checkout this http://stackoverflow.com/questions/21873723/printing-debug-output-to-console-in-codeception – Kotie Smit Jun 12 '14 at 06:44

2 Answers2

8

Today I've found that in Codeception v2.01 there is a new method that allows you to print to screen.

<?php
codecept_debug($I->grabTextFrom('#name'));
?>

add the --debug flag to your command you use to run your tests with. eg.

php codecept.phar run --debug --steps acceptance
Kotie Smit
  • 646
  • 1
  • 5
  • 18
5

There is no specific command to print to screen / terminal while running a test.

I do the following:

$I->see($I->grabTextFrom('#myelement'));

This way I can at least dump the contents of a element.

Check this out. I haven't tried this one yet, but looks promising

Printing debug output to console in Codeception

Community
  • 1
  • 1
Kotie Smit
  • 646
  • 1
  • 5
  • 18