I read a lot about unit and integration tests and how they work with maven and java and how it works with Continuous Integration.

I am using Flyway for db migrations, the schema part is already done.

But it is not clear to me how to get the data for integration tests.

What is the best or most common choice and why? Below some ideas that I had.

  • A static SQL dump along with integration test code;

  • A script that makes a dump from Production every time the integration test runs;

  • Something like @parametrizedTest from JUnit (static code that generates the data);

  • Which components exactly do you want to check integration? Both the integration for boundary objects <-> DAOs and DAOs <-> DB mechanism can be checked by mocking the right-hand side element. – João Farias May 9 at 7:08
  • In my understanding, integration tests should use real instances, and not mocks (they are more used in unit tests). The components I want to test involves services -> DAOs -> copy of production db (but with test data). The question is what is the recommended way to do it. – Luciano Brum May 9 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.