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?
附言升级到 v. 2016.3 后未更改任何设置
P.S. No settings were altered after upgrading to v. 2016.3
推荐答案
好吧,在玩"了一下每个单元测试的运行配置后,我注意到每个运行配置都有一个 Build
目标预设在 Before Launch
选项中(见下图):
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屋!