1

We have a Java project where we have placed all the tests for the source code in one place at this path: src/test/java/com/temp. At this path we have placed all kinds of tests which includes unit tests, integration tests, smoke tests etc.

And I would like to get some idea on how we can organise it in a better way, such that it will help in organising future tests written for the project. Another motivation is that we can easily distinguish where exactly particular type of tests reside in the project.

I found this stack overflow answer: How do you organize tests in a modular Java project?

But in the above link, there was no mention of organising different kinds of tests

Eric Anderson
  • 24,057
  • 5
  • 55
  • 76
Sukhbir
  • 553
  • 8
  • 23
  • 2
    Does this answer your question? [Separation of JUnit classes into special test package?](https://stackoverflow.com/questions/2388253/separation-of-junit-classes-into-special-test-package). Also check https://stackoverflow.com/questions/23635120/eclipse-java-separate-unit-test-and-integration-test and https://stackoverflow.com/questions/36396265/how-to-organize-unit-and-integration-tests – pringi Feb 11 '22 at 10:45

1 Answers1

2

It is good idea to have all the tests under src/tests folder. Within src/tests folder, I generally created one folder for each kind of tests. So something like this - src/tests/integration

src/tests/unit

src/tests/smoke

In our current project, due to some dependencies, we have kept integration tests directly under src directory. I guess it all works fine if you have all the similar kind of tests organized under a folder with that name (integration for example).

Dharman
  • 30,962
  • 25
  • 85
  • 135
adeveloper
  • 80
  • 1
  • 8