I have a java project in maven and i know maven puts thing conventionally using
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:
?
but doing this way would assume src/test/java is referring to unit tests. I rather have a clearly specified
The simplest way to run integration tests is to use the Maven failsafe plugin. By default, the Maven surefire plugin executes unit tests during the test phase, while the failsafe plugin runs integration tests in the integration-test phase.
Junit Framework can be integrated with Eclipse, Ant and Maven, but in this article we will be using Maven.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With