How do I view the stdout of a successful unit test?

This seems like such a dumb question, but I can't figure it out.

When I run my TestNG tests, if they succeed then I can't see the output from them.  How can I view the output from successful TestNG tests?

10 comments
Comment actions Permalink

The stdout is located at the corresponding editor:

testng.png
Denis

0
Comment actions Permalink

While the tests are running I can see their output, but as soon as they complete all I see is:


[TestNG] Running:
  /Users/ian/Library/Caches/IntelliJIdea12/temp-testng-customsuite.xml


Process finished with exit code 0



(See attached screenshot).  I can't figure out how I can get to the test output.

Attachment(s):
Screenshot 1:25:13 11:30 AM.png
0
Comment actions Permalink

How do you run the tests? Right click on a test class and 'Run my-test-class'? Something else?

Denis

0
Comment actions Permalink

I right-click on the project and select Run -> All Tests.

0
Comment actions Permalink

Still unable to reproduce that (tests stdout is written in a control identified by a red arrow at the screenshot posted above).

Please provide a sample project and your settings (Main Menu | File | Export Settings).

Denis

0
Comment actions Permalink

Sorry to revive this old thread, but I'm facing this same issue. I can see output only at some times. From what I can infer, output is printed but it is cleared immediately. Only "Process finished with exit code 0' is printed in the end.

0
Comment actions Permalink

Hello,

There is a possible case that more than one test is executed. Then there is a 'shared log' and 'per-test log'. The first one is automatically cleared as soon as the test complets but you can click test node (at the left) to see exact test output.

Denis

0
Comment actions Permalink

Excellent! I can see output now. Thanks a lot.

0
Comment actions Permalink

You are welcome

Denis

0
Comment actions Permalink

same thing happening and it is annoying! when individual test runned console output is not visible only thing visible at console is Process finished with exit code 0.

Maven, Junit.

Source of problem:

 
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
@Before
public void setUpStreams() throws UnsupportedEncodingException {
System.setOut(new PrintStream(outContent,true, "UTF-8"));
System.setErr(new PrintStream(errContent,true, "UTF-8"));
}

@After
public void cleanUpStreams() {
System.setOut(stdout);
System.setErr(stderr);
}

 

0

Please sign in to leave a comment.