IntelliJ mvn项目测试类无法正常运行

编程入门 行业动态 更新时间:2024-10-26 02:24:30
本文介绍了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项目测试类无法正常运行

本文发布于:2023-11-25 05:52:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628575.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:正常运行   测试   项目   IntelliJ   mvn

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!