programatically set Spring profile in Cucumber -
i have begun use cucumber tests spring application. set active spring profile passing jvm argument spring.profiles.active=testprofile.
is there way programatically? like:
@runwith(cucumber.class) @cucumber.options(...) @activeprofiles("testprofile") public class mycucumbertest
using cucumber 1.1.6
i'm not sure proper way it, @ least working me. i'm using cucumber version 1.2.4
i specialized cucumber junit runner set wanted spring profile in constructor: public class springprofilecucumber extends cucumber { public springprofilecucumber(class clazz) throws initializationerror, ioexception { super(clazz); system.setproperty("spring.profiles.active", "testprofile"); } }
in test use springprofilecucumber junit runner @runwith(springprofilecucumber.class) @cucumberoptions(features = {"src/test/java/tests/cucumber/test.feature"}, glue = { "tests.cucumber"}) public class mycucumbertest { // ... test }
Comments
Post a Comment