In a TDD (Test-Driven Development)-based Java project built by maven, lots of classes needs to be tested with text-based input files such as .csv
. At the beginning, I put them into the src/test/resources
directory. But along with the increase of the amount of test input .csv
files, to know which input files used for which classes has become more and more difficult and messy.
A senior Javascript developer suggested to put the test files directly into the corresponding Java package probably on base of the unit test practice in Javascript. For instance, there is a class in src/main/java/com/AutoRobot.java
, correspondingly there is a test class in src/test/java/com/AutoRobotTest.java
and the test input csv file is also in the src/test/java/com
directory.
Question: are there disadvantages to put the text-based files into the Java package, esp. when many text files are stored in the Java class package? Is it a good practice to do so? If not are there any similar alternative solutions?