22

I have a java project in maven and i know maven puts thing conventionally using

  • src/main/java
  • src/test/java

and everything under test/ is usually unit test. But what if i want to introduce integration tests and E2E tests? 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/e2e/java
  • src/test/java

?

but doing this way would assume src/test/java is referring to unit tests. I rather have a clearly specified

SoftwareDeveloper
  • 1,094
  • 2
  • 15
  • 26

1 Answers1

7

I would suggest to use the maven defined directory structure - src/test/java. You can change the maven defined directory structure, but it's not recommended. 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.

Refer to - How to run UnitTests in maven which is in src/test-integration/java folder

Community
  • 1
  • 1
asg
  • 2,248
  • 3
  • 18
  • 26
  • 4
    Maven standard directory layout (now) lists a standard folder for integration tests (`/src/it`). I guess it is acceptable to have a similar `/src/e2e` folder. You still have to setup your `pom.xml` to see the new folders, but that way you are not obliged to create (and maintain) test suites for each kind of tests. You can simply include relevant folders in _ad hoc_ profiles, and let the unit test run automatically on each install. – Alessio Gaeta Dec 14 '17 at 10:50