JUnit tests always report interrupted during 1st test

I have a JUnit TestCase. It has 2 tests in it.

Build 4101

Whenever I try to run the TestCase, the JUnit integration shows that the first test gets interrupted and the 2nd is never run. If I step through in the debugger, I see it running, but the System.out.println()s never show up on the Console.

Is this familiar to anyone?

3 comments

Hello Danny,

D> I have a JUnit TestCase. It has 2 tests in it.
D>
D> Build 4101
D>
D> Whenever I try to run the TestCase, the JUnit integration shows that
D> the first test gets interrupted and the 2nd is never run. If I step
D> through in the debugger, I see it running, but the
D> System.out.println()s never show up on the Console.
D>
D> Is this familiar to anyone?

This may be related to a recent JUnit fix made in 5.1. What is your system
locale, and what is the "File Encoding" setting in the IDEA General Settings?
Does the println() print some non-ASCII characters? If it does, does the
problem go away if you print only ASCII?

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Thanks for pointing me to the println()s Dmitry. It happened because I was closing System.out in each test. That explains why I didn't see any output, but not why the test showed as "interrupted."

So now I'm not closing System.out, and everything is fine, but you may (or may not) still have a bug in displaying "interrupted" for tests that close System.out.

0

Hello Danny,

D> Thanks for pointing me to the println()s Dmitry. It happened because
D> I was closing System.out in each test. That explains why I didn't
D> see any output, but not why the test showed as "interrupted."
D>
D> So now I'm not closing System.out, and everything is fine, but you
D> may (or may not) still have a bug in displaying "interrupted" for
D> tests that close System.out.

This behavior is by design. IDEA uses the standard output stream for communicating
between the test runner and the IDE, so closing that stream will cause the
communication to break.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Please sign in to leave a comment.