Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
492 views
in Technique[技术] by (71.8m points)

grails test-app to output to console

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?

question from:https://stackoverflow.com/questions/2217873/grails-test-app-to-output-to-console

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...