I understand from the previous answers on this site that, for Maven builds:
src/main/java
will be deployed to production whereassrc/test/java
will not be.src/main/java
contains the main application whereassrc/test/java
will contain code to test the main app
Now my question is, when writing a test framework, which approach is better/worse:
- Test framework itself will be the main app - hence it will reside on
src/main/java
? - Test framework will only be used to test the main app - hence will reside on
src/main/java
?
Somehow getting stuck on visualizing this properly -
Approach 1 seems to be correct as a test framework will be the main purpose of the build hence that will be the main app.
But then somehow I cannot imagine a test framework being deployed to production.
Approach 2 seems to be correct, but then if the main purpose is to write a test framework then what will go inside
src/main/java
? Will that be empty or non-existing for my test framework app?
Any suggestions on this would be helpful.
I think you're going astray with
I would rephrase it as
src/main/java
(This assumes that you build the testing framework as a separate module)
If you need real life examples, you don't need to look any further than
JUnit
(the legendary testing framework)Prefer to work with
TestNG
? The code for TestNG is in a submodule "core", but even then: