What does a comma mean in the output from running tests with phpunit?

Issue

I have output from running a test suite with phpunit. I understand that periods (.) mean a passed test, but what does a comma (,) mean?

16:10:12
PHPUnit 6.1.3 by Sebastian Bergmann and contributors.
..............................F...,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,E..,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
..........  63 / 145 ( 43%)

Solution

If you take the string

..............................F...,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,E..,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
..........

and remove new lines, it amounts to 300 characters.

If we remove the ,, it amounts to 63 characters, which matches the progress output from phpunit:

63 / 145

That is, as @Hollings suggested, you are echoing a , repeatedly in your tests somewhere.

You can adjust your phpunit.xml to be as strict as possible about risky tests:

<phpunit
    beStrictAboutOutputDuringTests="true"
    verbose="true"    
 >
    <testsuites>
        ...
    </testsuites>
</phpunit>

Specifically, you are looking to enable this option

beStrictAboutOutputDuringTests="true"

in combination with enabled verbosity

verbose="true"

If you then run the tests, phpunit will let you know which tests cause output, for example:

PHPUnit 6.1.3 by Sebastian Bergmann and contributors.

Runtime:    PHP 7.1.5
Configuration:  /Users/am/Sites/stackoverflow/45547842/phpunit.xml

R,

Time: 43 ms, Memory: 4.00MB

There was 1 risky test:

1) FooTest::testBar
This test printed output: ,

For reference, see:

Answered By – localheinz

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published