开发者

JUnit Eclipse show System.out.print()'s

I am using JUnit 3 with Eclipse 3.4. When I run a JUnit test case everything works fine and the test completes perfectly. Only thing is I want to see the output of the classes that I am running. All the classes have basic System.out.print() to some output values. So when I run the tests I don't see any console messages at all. How do I get Eclipse to show System.out.pri开发者_高级运维nt() output in Console window when a test is successful?


Maybe other program was running on the console of Eclipse too. Please ensure Eclipse displays the active view of your JUnit code.

From Eclipse Help:

Select the “Display Selected Console” command to bring the console selected from the resulting list into focus. Note: this command is only enabled if you have more than one console open.


jUnit does not suppress System.out statements. If the statement is hit during the test run, then it is executed and writes to System.out which is, when executed within eclipse (Run Configuration), the console window.

But maybe you've redirected System.out to write to a file or a log.


If you want to see the stack trace (and not System.out) in the Console, instead of in the Failure Trace window, select the "Show Stack Trace In Console View" button:

JUnit Eclipse show System.out.print()'s

click on the button as show above


I had the same problem, and i solve it putting @Test above the function test with the output, and that solved it ... Hoping that this can help ... :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜