PHPUnit does not provide enough information about missed and incomplete tests

I am trying to capture the output of PHPUnit:

$pu_result = new \PHPUnit_Framework_TestResult(); $pu_result->addListener(new \PHPUnit_Util_Log_JSON()); $pu_suite = new \PHPUnit_Framework_TestSuite(); // here I add tests // $pu_suite->addTestSuite(...); ob_start(); $pu_suite->run($pu_result); $output = ob_get_clean(); 

this gives me a json encoded string like $ output (bad json btw, but I can fix it).

The problem is that the "message" property for incomplete and missed tests is "Missed test" or "Incomplete test" and does not contain the message that I indicated in calls to $this->markTestIncomplete() or $this->markTestSkipped() : (

Can I get this too?

+4
source share
3 answers

You can get them in the JSON log by upgrading to the latest version 3.6. If you look at the last PHPUnit_Util_Log_JSON source for addIncompleteTest and addSkippedTest , I see that they both add an exception message to the log. However, I cannot find when this change was made. If these changes are not specified in 3.6.x, you can create your own subclass and easily override these methods.

+3
source

Try running phpunit with the -v option (--verbose)

+5
source

Monitoring the definition of the printerClass parameter in the phpunit.xml configuration or any other configuration. The default printer class will include skipped tests, while others will not.

"PHPUnit_TextUI_ResultPrinter" , for example, does not print missed tests.

0
source

All Articles