JUnit5 Jupiter测试在IntelliJ中终止 [英] JUnit5 Jupiter test terminated in IntelliJ

查看:138
本文介绍了JUnit5 Jupiter测试在IntelliJ中终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行单元测试时,它们将立即终止.但是,没有记录. (仅无法启动"和处理完成,退出代码为255").

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').

测试之前有效... JUnit 4不会给我这个问题. 测试确实可以在Maven中成功运行.

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

我使用JUnit5 Jupiter和IntelliJ IDEA 2020.1(最终版).

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

有任何想法吗?

推荐答案

我只是遇到了同样的问题.

I just had the same issue.

解决此问题的唯一方法是-我可以复制的是: 不要.close()System.out (或System.err).

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.

无论我何时将System.out传递给将.Output()稍后关闭其OutputStream的函数,我都将其替换为新的ByteArrayOutputStream().

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

这篇关于JUnit5 Jupiter测试在IntelliJ中终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆