21

Howto set the output in test console? When i run test by default the output is replaced by the summary of the test, and System.outs are lost.

user1085746
  • 293
  • 1
  • 2
  • 8

7 Answers7

51

In IDEA 12,13 and 14 (also maybe other versions), there is a button "Hide passed tests" and is pressed by default:

enter image description here

The console output is missing some of the printed strings (the last ones). When you uncheck the button and click on the test:

enter image description here

Then the output is shown in the console.

mirelon
  • 4,896
  • 6
  • 40
  • 70
7

I got it! There is an configuration option in bottom run panel, and by default "Track running test" is checked, when I unchecked it the output stays and is no more replaced by summary.

Line
  • 1,529
  • 3
  • 18
  • 42
user1085746
  • 293
  • 1
  • 2
  • 8
3

Another possibility is that your logging is maybe configured to be written to a file. If this is the case, you can uncheck the 'Save console output to file' option.

enter image description here

Mathias G.
  • 4,875
  • 3
  • 39
  • 60
0

What version of IntelliJ are you using? Normally when running a unit test, you have a Run tab at the bottom of your application and you see appear your test logging (System.outs) in there...

Mathias G.
  • 4,875
  • 3
  • 39
  • 60
0

If your test output disappear when the test finish to run (and failing),

Disable "Select First Failed test When Finished" in order to see all prints

enter image description here

Aviram Fireberger
  • 3,910
  • 5
  • 50
  • 69
-1

In the 2016.x versions, you need to change so that your launch configuration has "Activate Tool Window" unchecked (at the bottom).

enter image description here

Boon
  • 1,871
  • 1
  • 21
  • 31
-2

It's different for tests that failed and tests that works.

If no test fails you'll have to click the top level of all tests that ran you'll see the output.

If you click on any specific working test they'll be empty, even if they printed something. If you click on any specific failing test they'll show the output from all previous tests, including the one that failed.

Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78
  • 1
    IDEA 13 now shows output when you click on a specific passed test. However, some of the output (the last printed) is not shown when the focus is on on specific test (ie. focus is on the package or on the class) – mirelon Mar 12 '14 at 09:56
  • 1
    Is there a way to disable this behavior? It causes a lot of trouble if you want to check some logs.. Also printing to log file doesn't print all the logs. – Bhushan Nov 12 '14 at 02:06