Sukhbir
Sukhbir

Reputation: 661

How to organise different kinds of tests in Java project?

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

Upvotes: 1

Views: 355

Answers (1)

adeveloper
adeveloper

Reputation: 80

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).

Upvotes: 2

Related Questions