IntelliJ mvn项目测试类无法正常运行 [英] IntelliJ mvn project test classes not functioning

查看:124
本文介绍了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项目测试类无法正常运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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