本文介绍了IntelliJ mvn项目测试类无法正常运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的maven项目中由于某种原因,即使类和测试类位于同一个包中,当我执行Ctrl + Shift + T时它会显示No Test Class Found。
更重要的是,当我右键单击测试文件时,它只给我编译测试的选项,但不是运行测试。
如果我只是在命令行中执行mvn clean install,我就能成功运行测试。
有什么想法?
解决方案您需要在项目设置 - >模块中将测试文件/目录标记为测试源吗? / p>
In my maven project for some reason, even though the class and the test class are located in the same package, when I did Ctrl+Shift+T it says "No Test Class Found".
More importantly, when I right click on the test file, it only gives me the option to compile test, but not run test.
I'm able to run the tests successfully if I just do mvn clean install in command line.
Any idea?
解决方案You need to mark the test files/directories as "Test Sources" in Project Settings -> Modules?
更多推荐
IntelliJ mvn项目测试类无法正常运行
发布评论