JUnit5 Jupiter test terminated in IntelliJ

情到浓时终转凉″ 提交于 2021-01-28 14:24:44

问题


When I run the my unit tests, they immediatly are being terminated. However no logging is presented. (only 'Failed to start' and 'Process finished with exit code 255').

Tests worked before... JUnit 4 does not give me this problem. Test do run succesfully in Maven.

I use JUnit5 Jupiter and IntelliJ IDEA 2020.1 (Ultimate Edition).

Anyone any thoughts?


回答1:


I just had the same issue.

The single thing that fixed this - and which I could reproduce - is this: don't .close() System.out (or System.err).

@Test
void failure()
    {
    System.out.close();
    }

makes happen what you describe.

Wherever I passed System.out to functions that would .close() their OutputStream later, I replaced them with a new ByteArrayOutputStream() instead.



来源:https://stackoverflow.com/questions/63051696/junit5-jupiter-test-terminated-in-intellij

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!