Testing multiple servers with spring boot test
up vote
0
down vote
favorite
I have a multi-module maven project with a spring service in each module.
The problem I have is that I want to create a test with multiple servers.
So currently I have a couple of tests that are actually starting a server and doing some requests to it using the annotation @SpringBootTest
. And preferably I would like to test multiple servers with the same approach as it gives me the opportunity to mock for example the database connections. And I can of course mock parts of the HTTP calls if needed so that the servers can "communicate".
So I guess the question is:
Is it possible to test multiple servers in this way?
java spring maven testing spring-boot-test
add a comment |
up vote
0
down vote
favorite
I have a multi-module maven project with a spring service in each module.
The problem I have is that I want to create a test with multiple servers.
So currently I have a couple of tests that are actually starting a server and doing some requests to it using the annotation @SpringBootTest
. And preferably I would like to test multiple servers with the same approach as it gives me the opportunity to mock for example the database connections. And I can of course mock parts of the HTTP calls if needed so that the servers can "communicate".
So I guess the question is:
Is it possible to test multiple servers in this way?
java spring maven testing spring-boot-test
The question which comes into my mind: What kind of tests are you doing if you start servers etc. ? Furthermore in such cases I would suggest to take a look at testcontainers.org
– khmarbaise
Nov 9 at 8:36
The tests that I have right now are testing the flow between components inside one server. But there is nothing that tests that the servers are communicating properly with eachother(there are no clear requirements so we don't know what is working and what isn't). The issue with testcontainers.org is that I don't seem to be able to mock the contents of the database. We are using oracle with a bunch of tables, views and procedures making it quite difficult to setup in a test docker environment
– munHunger
Nov 9 at 8:42
Than I don't understand the part:The problem I have is that I want to create a test with multiple servers.
...
– khmarbaise
Nov 9 at 8:53
You're talking about a full integration test, and the way that's usually done is to have some sort of management software (e.g., Spinnaker) that deploys the different components and then runs the tests externally, making remote calls like a normal client would.
– chrylis
Nov 9 at 8:54
hmm, ok, to clarify I have a databaseA
and two serversB
andC
. BothB
andC
communicates withA
, butA
is to complex to start and thus I need to mock it. What I want to test is thatB
can send propper requests toC
.
– munHunger
Nov 9 at 8:57
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a multi-module maven project with a spring service in each module.
The problem I have is that I want to create a test with multiple servers.
So currently I have a couple of tests that are actually starting a server and doing some requests to it using the annotation @SpringBootTest
. And preferably I would like to test multiple servers with the same approach as it gives me the opportunity to mock for example the database connections. And I can of course mock parts of the HTTP calls if needed so that the servers can "communicate".
So I guess the question is:
Is it possible to test multiple servers in this way?
java spring maven testing spring-boot-test
I have a multi-module maven project with a spring service in each module.
The problem I have is that I want to create a test with multiple servers.
So currently I have a couple of tests that are actually starting a server and doing some requests to it using the annotation @SpringBootTest
. And preferably I would like to test multiple servers with the same approach as it gives me the opportunity to mock for example the database connections. And I can of course mock parts of the HTTP calls if needed so that the servers can "communicate".
So I guess the question is:
Is it possible to test multiple servers in this way?
java spring maven testing spring-boot-test
java spring maven testing spring-boot-test
asked Nov 9 at 8:32
munHunger
414315
414315
The question which comes into my mind: What kind of tests are you doing if you start servers etc. ? Furthermore in such cases I would suggest to take a look at testcontainers.org
– khmarbaise
Nov 9 at 8:36
The tests that I have right now are testing the flow between components inside one server. But there is nothing that tests that the servers are communicating properly with eachother(there are no clear requirements so we don't know what is working and what isn't). The issue with testcontainers.org is that I don't seem to be able to mock the contents of the database. We are using oracle with a bunch of tables, views and procedures making it quite difficult to setup in a test docker environment
– munHunger
Nov 9 at 8:42
Than I don't understand the part:The problem I have is that I want to create a test with multiple servers.
...
– khmarbaise
Nov 9 at 8:53
You're talking about a full integration test, and the way that's usually done is to have some sort of management software (e.g., Spinnaker) that deploys the different components and then runs the tests externally, making remote calls like a normal client would.
– chrylis
Nov 9 at 8:54
hmm, ok, to clarify I have a databaseA
and two serversB
andC
. BothB
andC
communicates withA
, butA
is to complex to start and thus I need to mock it. What I want to test is thatB
can send propper requests toC
.
– munHunger
Nov 9 at 8:57
add a comment |
The question which comes into my mind: What kind of tests are you doing if you start servers etc. ? Furthermore in such cases I would suggest to take a look at testcontainers.org
– khmarbaise
Nov 9 at 8:36
The tests that I have right now are testing the flow between components inside one server. But there is nothing that tests that the servers are communicating properly with eachother(there are no clear requirements so we don't know what is working and what isn't). The issue with testcontainers.org is that I don't seem to be able to mock the contents of the database. We are using oracle with a bunch of tables, views and procedures making it quite difficult to setup in a test docker environment
– munHunger
Nov 9 at 8:42
Than I don't understand the part:The problem I have is that I want to create a test with multiple servers.
...
– khmarbaise
Nov 9 at 8:53
You're talking about a full integration test, and the way that's usually done is to have some sort of management software (e.g., Spinnaker) that deploys the different components and then runs the tests externally, making remote calls like a normal client would.
– chrylis
Nov 9 at 8:54
hmm, ok, to clarify I have a databaseA
and two serversB
andC
. BothB
andC
communicates withA
, butA
is to complex to start and thus I need to mock it. What I want to test is thatB
can send propper requests toC
.
– munHunger
Nov 9 at 8:57
The question which comes into my mind: What kind of tests are you doing if you start servers etc. ? Furthermore in such cases I would suggest to take a look at testcontainers.org
– khmarbaise
Nov 9 at 8:36
The question which comes into my mind: What kind of tests are you doing if you start servers etc. ? Furthermore in such cases I would suggest to take a look at testcontainers.org
– khmarbaise
Nov 9 at 8:36
The tests that I have right now are testing the flow between components inside one server. But there is nothing that tests that the servers are communicating properly with eachother(there are no clear requirements so we don't know what is working and what isn't). The issue with testcontainers.org is that I don't seem to be able to mock the contents of the database. We are using oracle with a bunch of tables, views and procedures making it quite difficult to setup in a test docker environment
– munHunger
Nov 9 at 8:42
The tests that I have right now are testing the flow between components inside one server. But there is nothing that tests that the servers are communicating properly with eachother(there are no clear requirements so we don't know what is working and what isn't). The issue with testcontainers.org is that I don't seem to be able to mock the contents of the database. We are using oracle with a bunch of tables, views and procedures making it quite difficult to setup in a test docker environment
– munHunger
Nov 9 at 8:42
Than I don't understand the part:
The problem I have is that I want to create a test with multiple servers.
...– khmarbaise
Nov 9 at 8:53
Than I don't understand the part:
The problem I have is that I want to create a test with multiple servers.
...– khmarbaise
Nov 9 at 8:53
You're talking about a full integration test, and the way that's usually done is to have some sort of management software (e.g., Spinnaker) that deploys the different components and then runs the tests externally, making remote calls like a normal client would.
– chrylis
Nov 9 at 8:54
You're talking about a full integration test, and the way that's usually done is to have some sort of management software (e.g., Spinnaker) that deploys the different components and then runs the tests externally, making remote calls like a normal client would.
– chrylis
Nov 9 at 8:54
hmm, ok, to clarify I have a database
A
and two servers B
and C
. Both B
and C
communicates with A
, but A
is to complex to start and thus I need to mock it. What I want to test is that B
can send propper requests to C
.– munHunger
Nov 9 at 8:57
hmm, ok, to clarify I have a database
A
and two servers B
and C
. Both B
and C
communicates with A
, but A
is to complex to start and thus I need to mock it. What I want to test is that B
can send propper requests to C
.– munHunger
Nov 9 at 8:57
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222220%2ftesting-multiple-servers-with-spring-boot-test%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The question which comes into my mind: What kind of tests are you doing if you start servers etc. ? Furthermore in such cases I would suggest to take a look at testcontainers.org
– khmarbaise
Nov 9 at 8:36
The tests that I have right now are testing the flow between components inside one server. But there is nothing that tests that the servers are communicating properly with eachother(there are no clear requirements so we don't know what is working and what isn't). The issue with testcontainers.org is that I don't seem to be able to mock the contents of the database. We are using oracle with a bunch of tables, views and procedures making it quite difficult to setup in a test docker environment
– munHunger
Nov 9 at 8:42
Than I don't understand the part:
The problem I have is that I want to create a test with multiple servers.
...– khmarbaise
Nov 9 at 8:53
You're talking about a full integration test, and the way that's usually done is to have some sort of management software (e.g., Spinnaker) that deploys the different components and then runs the tests externally, making remote calls like a normal client would.
– chrylis
Nov 9 at 8:54
hmm, ok, to clarify I have a database
A
and two serversB
andC
. BothB
andC
communicates withA
, butA
is to complex to start and thus I need to mock it. What I want to test is thatB
can send propper requests toC
.– munHunger
Nov 9 at 8:57