E
E
EVGENY T.2021-08-17 10:02:56
Java
EVGENY T., 2021-08-17 10:02:56

How to organize tests in a multi-module project?

Hello.

There is a multi-module spring-boot project in gradle.

Modules:
-- core (here are the classes needed by the services, there are common dao)
-- app-service1 (spring-boot application that uses core, there are specific dao, spring configuration, liqubase configuration)
-- app-service2 (and here its own configuration)

Now I have chosen the approach that in which module the class is, that is the test for it. This leads to the fact that in each module there are test spring configurations, files for liqubase. There are a lot of services, which means there will be a lot of repetitive configurations, which is bad, of course.

I'm thinking of making a separate module for tests, then it seems like there will be a common configuration for all. And what do you think?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Roo, 2021-08-17
@Beshere

Probably, unit tests can only be in a module and in one package with code: they don’t need dependencies, they don’t need any configs or test migrations.
Integration, due to the fact that they may have dependencies, incl. from other packages or cover the functionality of the entire project may well be located in a separate module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question