I have a question. Requesting your help.
We have a spring boot application and I have written integration tests without Mocks, instead with TestRestTemplate and @SpringbootTest
.
So on local machine, when i execute the tests, they execute fine as i have given MyApplication.class
inside @SpringbootTest
It will startup the spring application context and execute the tests.
Till here everything is fine.
But we deploy this application on different test environments like qa,e2e,staging and then on production. So we have to execute the Jenkins Job for my integration tests against the above environments as an acceptance tests.
My Question over here is :
- When I execute these tests on jenkins, the tests get executed on a Jenkins Slave machine(which is picked randomly among the available executors) and it will hit the end points (either qa or e2e or staging or production end points) and send rest requests and get the responses and validate. But the tests start up the application context on the jenkins slave and loads on a random port and will be available on the jenkins slave machine till the tests finish though I am not at all interacting with the application context( as i am hitting external test end points). Is there any option not to load the spring application context when I am trying to run tests against real test server and to load the application context when testing on local?
Please help.. I am kind of new to spring boot and got stuck here.
Thank you very much in advance