【问题标题】:Is there a method to output to STDOUT in a Grails Spock test?在 Grails Spock 测试中是否有输出到 STDOUT 的方法?
【发布时间】:2012-02-09 20:11:28
【问题描述】:

我想通过在每个测试开始时输出到 STDOUT 来跟踪我的 Grails Spock 集成测试的进度。因此,在测试运行时,服务和控制器的日志数据输出以及显示测试开始的输出是混合的。

例子:

开始测试 1

2012-02-09 13:01:41,375 [main] DEBUG  - Adding included service vertex 2 to DAG

2012-02-09 13:01:41,377 [main] DEBUG  - Adding this service vertex 4f34262584ae3fec6cc2d0f0 to DAG

开始测试 2

2012-02-09 13:01:41,377 [main] DEBUG   - Connecting included service vertex 4f34262584ae3fec6cc2d0f0 to 2

2012-02-09 13:01:41,379 [main] DEBUG   - Added all the edges to the DAG for this service 4f34262584ae3fec6cc2d0f0

开始测试 3

...

【问题讨论】:

    标签: testing grails integration-testing spock


    【解决方案1】:
    println in cleanup:
    
    grails test-app --echoOut
    

    显示测试结束。

    【讨论】:

    • 这在 Grails 2.5.3 中仍然有效吗?我试过这个,但我没有从服务中得到 log.info 输出。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-06
    • 2015-06-23
    • 2012-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多