java.lang.Exception:未找到与使用Intellij IDEA的方法匹配的测试 [英] java.lang.Exception: No tests found matching Method using Intellij IDEA

查看:154
本文介绍了java.lang.Exception:未找到与使用Intellij IDEA的方法匹配的测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了Intellij IDEA 2016.3.的奇怪行为.当我在运行测试时得到java.lang.Exception: No tests found matching Method foo时,有一个带有方法foo的类和对该方法的JUnit测试.我执行mvn test后,它成功了,然后在执行mvn命令后立即运行单元测试,它突然运行为绿色.似乎IDEA不会自动编译.我该如何解决?

I am experiencing a strange behavior of Intellij IDEA 2016.3. Having a class with method foo and a JUnit test for the method when I get java.lang.Exception: No tests found matching Method foo when running the test. After I do mvn test it succeeds and then running the unit test right after executing mvn command it suddenly runs green. Seems like IDEA does not compile automatically. How can I fix this?

P.S.升级到v.2016.3后,没有任何设置更改

P.S. No settings were altered after upgrading to v. 2016.3

推荐答案

好吧,在播放"了每个单元测试的运行配置后,我注意到每个Run Config在Before Launch中预设了一个Build目标.选项(请参见下图):

Well, after "playing" a bit with run configurations of each unit test I noticed that each Run Config has a Build goal preset in the Before Launch option (See pic below):

Build更改为Build Project后,测试运行正常.

After changing Build to Build Project the tests run fine.

这篇关于java.lang.Exception:未找到与使用Intellij IDEA的方法匹配的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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