grails test-app输出到控制台 [英] grails test-app to output to console

查看:79
本文介绍了grails test-app输出到控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是来自Django的grails新手。

使用测试驱动开发,我习惯于编写测试和实际功能。对于我来说编写测试非常有效,运行带有一些调试输出的函数以查看变量状态,直到单元测试通过,然后移动调试输出。



在Grails中,'grails test-app','log.debug'和'println'的输出不会记录到控制台,也不在报告中。



文档指向使用mocklogging,它应该输出log.debug调用到控制台,但使用grails 1.2.1,我看不到任何输出。



任何人都可以让我知道如何在控制台中看到'println'或'log.debug'的输出以加快我的研发速度吗?

解决方案

将-echoOut开关添加到grails test-app,这是 new在1.2版本中:

  grails test-app -echoOut 

还有其他一些有用的switche还包括:

echo System.err消息:

  grails test-app -echoErr 

在运行测试之前强制清理(不使用grails清洁&& grails test-app):

  grails test-app -clean 

只运行单元测试:

  grails test-app单位: 

只运行整合测试:

<$ p $在特定的环境中运行: b
$ b

grails test-app integration:

/ p>

  grails -Dgrails.env =生产测试应用程序

仅针对特定测试类(如com.foo.MyControllerTests),
运行测试,请确保不要使用测试后缀:

  grails test-app com.foo.MyController 

仅重新运行上次运行测试失败的测试

  grails test-app -rerun 


I am new to grails, coming from Django.

Using test driven development, I am used to writing tests and then actual functionality. What works well for me it to write the test, run the function with some debug output to see that state of variables until the unit test passes, and then moving the debug output.

In grails the 'grails test-app', the output of 'log.debug' and 'println' is not recorded to the console, and it is not in the reporting either.

The documentation point to using mocklogging, which should output the log.debug calls to the console, but using grails 1.2.1, I can not see any output.

Can any one please let me know how to see the output of 'println' or 'log.debug' in the console to speed up my developement?

解决方案

Add the -echoOut switch to grails test-app, this is new in the 1.2 release:

grails test-app -echoOut

There are a number of other useful switches on test-app as well, including:

echo System.err messages:

grails test-app -echoErr

force a clean before running tests (without doing grails clean && grails test-app):

grails test-app -clean

only run unit tests:

grails test-app unit:

only run integration tests:

grails test-app integration:

run in a particular environment:

grails -Dgrails.env=production test-app

run tests only for a particular test class (like com.foo.MyControllerTests), be sure to leave off the "Tests" suffix:

grails test-app com.foo.MyController

rerun only the tests that failed the last time you ran your tests

grails test-app -rerun

这篇关于grails test-app输出到控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆