How to debug your automated testing?

Writing your automated tests is done quickly … but it is debugging them that sometimes is time-consuming.

Whenever you have test step FAILURES, you can quickly append any of the following command line options to target a specific FAILURE and to help you converting it into a PASS.

Debugging options

Whenever debugging your test FAILURES, you often are not interested in all the other test steps that have PASSED.

The to=”fail” option means that, as soon as the first test <step> fails, the automated testing tool will terminate, and set the focus on the log output of that test FAILURE, which makes it easy for you to focus on it without having to scroll through other log information.

The verbose=”fail” option enhances the test log with extra-useful information about why the test might have failed, most importantly the complete return string of the web request (HTML, JSON, etc). This should give you enough information at hand to fix your application code (or to fix your test) without having to manually execute your test once again in your web browser at all.

php run.php testsuite=”Examples/1_hello_world.xml” to=”fail” verbose=”fail”

Verbose logging

The verbose=”” option enhances the test log with the complete return string of the web request (HTML, JSON, etc) and other useful debugging information about how the test <step> exactly executed at runtime.

The verbose=”fail” option gives debugging information only for those test <steps> that are FAILURES, but not for any PASSES:

php run.php testsuite=”Examples/1_hello_world.xml” verbose=”fail”

The verbose=”all” option gives debugging information for all the test <steps> in your test suite:

php run.php testsuite=”Examples/1_hello_world.xml” verbose=”all”

Running tests from and to a line number

The from=”” and the to=”” options allow you to run your test suite from any specific line number up to a specific line number terminating the test suite at that point.

This means you never have to execute any tests in your automation test suite that are not related to the test you want to debug:

php run.php testsuite=”Examples/1_hello_world.xml” from=”20″ to=”25″

This will only start the automated test suite from line number 20, but continue it right to the end:

php run.php testsuite=”Examples/1_hello_world.xml” from=”20″

This will start the automated test suite from the beginning, but terminate it at line number 25:

php run.php testsuite=”Examples/1_hello_world.xml” to=”25″