How to integration test Spring Boot application with multiple configurations -
we have integration test base class
@springapplicationconfiguration(classes = { myapp.class, testconfig.class }) @integrationtest({ "foo:bar", "baz:qux" }) @webappconfiguration @runwith(springjunit4classrunner.class) public abstract class baseintegrationtest { ... }
what we'd add parameter @integrationtest
single test class. works quite when running tests in separately, when running tests, parameter not added.
is there way around this? e.g., starting new app single test class?
basically, i'd is:
public class testone extends baseintegrationtest { ... } @integrationtest({ "foo:zorblax" }) public class testtwo extends baseintegrationtest { ... }
it seems if separate base classes, application configured separately.
what ended doing:
@webappconfiguration @runwith(springjunit4classrunner.class) public abstract class baseintegrationtest { // common methods , fields, // @before, @postconstruct, etc. } @springapplicationconfiguration( classes = {...} ) @integrationtest({ "foo:bar", "bar:baz" }) public abstract class withparamsone extends baseintegrationtest { // empty } @springapplicationconfiguration( classes = { /* different */ } ) @integrationtest({ "foo:zorblax" }) public abstract class withparamstwo extends baseintegrationtest { // empty } public class actualtest extends withparamsone { // @test } public class secondactualtest extends withparamstwo { // @test }
Comments
Post a Comment