简体   繁体   English

如何在maven中为Java项目组织单元,集成,e2e测试文件夹结构?

[英]How to organise unit, integration, e2e tests folder structure in maven for a Java project?

I have a java project in maven and i know maven puts thing conventionally using 我在maven有一个java项目,我知道maven把东西常规使用

  • src/main/java 的src /主/ JAVA
  • src/test/java 的src /测试/ JAVA

and everything under test/ is usually unit test. 一切都在测试/通常是单元测试。 But what if i want to introduce integration tests and E2E tests? 但是,如果我想引入集成测试和E2E测试呢? How should i put in the correct folder structure? 我该如何放入正确的文件夹结构? What is the correct way to organise these? 组织这些的正确方法是什么?

could this be it: 可能是这样的:

  • src/it/java SRC /它/ JAVA
  • src/e2e/java SRC / E2E / JAVA
  • src/test/java 的src /测试/ JAVA

?

but doing this way would assume src/test/java is referring to unit tests. 但这样做会假设src / test / java指的是单元测试。 I rather have a clearly specified 我宁愿明确指定

I would suggest to use the maven defined directory structure - src/test/java. 我建议使用maven定义的目录结构--src / test / java。 You can change the maven defined directory structure, but it's not recommended. 您可以更改maven定义的目录结构,但不建议这样做。 Ideally this structure is meant for unit tests, but you can still add integration and e2e unit tests into that folder structure with little modifications. 理想情况下,此结构适用于单元测试,但您仍然可以将集成和e2e单元测试添加到该文件夹​​结构中,几乎不做任何修改。

Refer to - How to run UnitTests in maven which is in src/test-integration/java folder 请参阅 - 如何在maven中运行UnitTests,该单元位于src / test-integration / java文件夹中

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

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