【问题标题】:symfony2 don't understand the output of unit testsymfony2 不理解单元测试的输出
【发布时间】:2015-09-14 04:15:32
【问题描述】:

我是 symfony2 的新手,正在学习如何在这个框架中进行单元测试,我按照教程 http://symfony.com/doc/current/book/testing.html 创建了 php“计算器”和测试类

C:\xampp\htdocs\sym1\blog>phpunit -c app src/AppBundle/Tests/Util/CalculatorTest
.php
PHPUnit 3.7.21 by Sebastian Bergmann.

Configuration read from C:\xampp\htdocs\sym1\blog\app\phpunit.xml.dist

.

Time: 0 seconds, Memory: 3.00Mb

[30;42m[2KOK (1 test, 1 assertion)
[0m[2K

我运行了命令,但是我不明白输出,这个输出是什么意思?

Time: 0 seconds, Memory: 3.00Mb

[30;42m[2KOK (1 test, 1 assertion)
[0m[2K

【问题讨论】:

    标签: php symfony phpunit


    【解决方案1】:

    这意味着你有:

    一个测试:这意味着您在所有测试类(名称以Test 结尾的)中总共有一个方法(名称以test 开头)

    一个断言:在所有测试中,您都有一个 $this->assert* 调用(如 assertTrueassertFalse 等)

    还要注意Time 0 seconds 上方的.(点)。一个点表示测试成功(没有测试失败)。你有更多的测试,打印更多的点。点会在失败的情况下变成F,在错误的情况下变成E - 更多的选项是可能的。

    【讨论】:

    • thx,但是concole "[30;42m[2K""上出现了一些不道德的字符
    • 这无关紧要,可能是我的一些编码问题。这是您通常有时间总结的地方 - 执行测试花费了多少时间
    猜你喜欢
    • 2012-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-26
    • 1970-01-01
    • 1970-01-01
    • 2014-06-28
    • 1970-01-01
    相关资源
    最近更新 更多