How can I combine @DataJpaTest @SpringBootTest in one MVC application for testing every layer?

J.J. Beam

Here https://stackoverflow.com/a/52968130/10894456 is well explained why @DataJpaTest @SpringBootTest shouldn't be mixed in one application.

But barely explained the case when anyway need to test every layer of MVC SpringBoot application (from my point it's natural to test not only one or only another layer but both and even all layers, isn't it?)

So there was suggested a solution to use @AutoConfigureTestDatabase rather than @DataJpaTest but didn't finish the job (((

So my question is: is using @AutoConfigureTestDatabase an appropriate solution? If yes, please explain details. If no, please suggest more appropriate solution, thank you

eis

Assuming you want the full application with the exception of database being in-memory, yes, combining @SpringBootTest with @AutoConfigureTestDatabase is an appropriate solution, as it does just that.

It is also mentioned in the documentation of @DataJpaTest:

If you are looking to load your full application configuration, but use an embedded database, you should consider @SpringBootTest combined with @AutoConfigureTestDatabase rather than this annotation.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I use @SpringBootTest(webEnvironment) with @DataJpaTest?

How can I combine two commits into one commit?

How do I import configuration classes in a @DataJpaTest in a SpringBootTest?

With GNU Make, how can I combine multiple files into one?

How can I combine an array of objects with the same keys into one object?

I have one component that is used on every page of my application. How do I declare it so it can be used globally?

How can I change the audio input from one device to another in web application using MVC?

how can I combine two search code into one

How can I combine the two spiders into just one?

How can I combine these 3 different queries into one?

How can I combine two userscripts into one?

How can I use MVC pattern with 3-layer?

How can I combine these two queries into one?

How can I combine two QStrings into one?

How can I combine application launchers into one launcher icon?

How can I combine two animated GIF images into one?

How can I combine my columns into one to create a URI in MySQL?

Kivy: How can I combine the two screens into one?

How can I combine these 2 queries to one?

How to combine Phaclon\Mvc\Application and Phaclon\Mvc\Micro in one project?

How can I combine multiple classes into a single one in SCSS?

In mvc application how can I show message one by one like notification?

How can I combine multiple Regex strings into one?

How can i combine two update requests into one?

How do I use spring @SpringBootTest instead of DataJPATest

SQL - How can I combine 3 similar queries into one?

How can I combine those arrays into one array?

How can I combine the above two steps in one using loop

How can I combine a comparison and an update in one atomic operation?