Why is PHPUnit creating the output “S” for a test that passes?

南笙酒味 提交于 2019-12-24 02:55:11

问题


I'm using PHPUnit in Eclipse IDE and this is the output when running my unit test:

PHPUnit 3.7.28 by Sebastian Bergmann.

.S.........

Time: 190 ms, Memory: 5.50Mb

OK (10 tests, 45 assertions)

The output has an S which suggests that a test is being skipped. However, there is no message "Skipped: 1".

According to the manual, the test output should look like this:

.S.........    
Time: 190 ms, Memory: 5.50Mb

1) UnitTest_Directory_Test::testBenthicCover
The MySQLi extension is not available.
/home/sb/DatabaseTest.php:9

OK, but incomplete or skipped tests!
OK (10 tests, 45 assertions, Skipped: 1)

Is the test actually passing, or is it being skipped?

Why do I not see Skipped: 1?

Environment: PHPUnit 3.7.28, Eclipse Java EE IDE, Version: Helios Service Release 2


I've logged the test results in json format for debugging:

    {"event":"suiteStart","suite":"UnitTest_Directory_Test","tests":10}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testBenthicCover"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testBenthicCover","status":"pass","time":0.27545499801636,"trace":[],"message":"","output":"S"}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfMeasurementAverage"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfMeasurementAverage","status":"pass","time":0.17307710647583,"trace":[],"message":"","output":""}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testEqualNumberOfSamplingUnitsPerSurveyParentToChild"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testEqualNumberOfSamplingUnitsPerSurveyParentToChild","status":"pass","time":0.0017728805541992,"trace":[],"message":"","output":""}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfCountPerUnitArea"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfCountPerUnitArea","status":"pass","time":0.0038161277770996,"trace":[],"message":"","output":""}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfFishCountPerUnitArea"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfFishCountPerUnitArea","status":"pass","time":0.0051858425140381,"trace":[],"message":"","output":""}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfPercentCover"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfPercentCover","status":"pass","time":0.0044069290161133,"trace":[],"message":"","output":""}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfGramsPerUnitArea"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfGramsPerUnitArea","status":"pass","time":0.0045709609985352,"trace":[],"message":"","output":""}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfGramsPerUnitVolume"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfGramsPerUnitVolume","status":"pass","time":0.0045430660247803,"trace":[],"message":"","output":""}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfTonsPerUnitAcreFromGramsPerUnitArea"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testCalculationOfTonsPerUnitAcreFromGramsPerUnitArea","status":"pass","time":0.0042028427124023,"trace":[],"message":"","output":""}
{"event":"testStart","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testParentEqualities"}
{"event":"test","suite":"UnitTest_Directory_Test","test":"UnitTest_Directory_Test::testParentEqualities","status":"pass","time":0.0016450881958008,"trace":[],"message":"","output":""}

来源:https://stackoverflow.com/questions/21267485/why-is-phpunit-creating-the-output-s-for-a-test-that-passes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!