2017-08-07 53 views
0

我從phpunit運行測試套件的輸出。我瞭解期間(.)是指通過測試,但逗號(,)是什麼意思?使用phpunit運行測試的輸出中逗號的含義是什麼?

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

','通常不從PHPUnit的輸出。你是否在迴應代碼中的逗號? – Hollings

回答

3

如果你把字符串

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

,並刪除新的生產線,它相當於字符。

如果我們去掉,,它相當於字符,這與從phpunit輸出進度:

63/145 

也就是說,@Hollings建議,您迴盪在你的測試中,反覆某處。具體

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

,你正在尋找啓用該選項

beStrictAboutOutputDuringTests="true" 

結合啓用冗長

你可以調整你的phpunit.xml要儘可能嚴格有關風險測試

verbose="true" 

如果您然後運行測試,phpunit wi LL讓你知道哪些測試會導致輸出,例如:

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: , 

僅供參考,請參閱:

+0

如果你喜歡我的回答,你能接受嗎?請參閱https://stackoverflow.com/help/someone-answers。 – localheinz

+1

我使用此方法檢查了代碼,最終找到了將文件發送到Amazon SQS的功能。在等待文件上傳時,它會輸出一個逗號(,)。這是逗號的來源!在所有的時期,E,F,S,I都與PHPUnit相關聯,我自然認爲逗號是該包的一部分。感謝@localheinz的詳細解釋。 – redheadedstep