简体   繁体   English

如何命令IntelliJ在反映您的项目结构的“ Tests”目录中创建相应的JUnit测试?

[英]How do you command IntelliJ to create corresponding JUnit tests in a “Tests” directory that mirrors your project structure?

I moved to JUnit 5 and now IntelliJ only gives me the option to create tests in the same directory as my classes. 我移至JUnit 5,现在IntelliJ仅使我可以选择在与类相同的目录中创建测试。 This is not good. 不是很好。 Why this is a readily available option some programmers use eludes me, as choosing such an option would seem to lead to garbled code. 为什么这是一些程序员容易使用的选项,使我难以理解,因为选择这样的选项似乎会导致代码混乱。

I would like all the tests to be created automatically into a corresponding directory that mirrors my project. 我希望将所有测试自动创建到与我的项目相对应的相应目录中。

From the comment that helped the OP. 从帮助OP的评论开始。 Adding it here as an answer as it could help others for various reasons. 将其添加到此处作为答案,因为它可能出于各种原因帮助其他人。

Check the following link and see if it helps. 检查以下链接,看看是否有帮助。 The ide allows you to mark the directory you want to be identified as the test folder. ide允许您将要标识的目录标记为测试文件夹。 Generated Test Sources Root 生成的测试源根

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM