java.lang.Exception:未找到与使用Intellij IDEA的方法匹配的测试 [英] java.lang.Exception: No tests found matching Method using 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屋!