You can set active profiles in spring via application context environment.
Since StrutsTestCase uses GenericXmlContextLoader which is not configurable you need to override setupBeforeInitDispatcher method in your test and use some context (e.g. XmlWebApplicationContext) where you can set profiles and call refresh.
@Override
protected void setupBeforeInitDispatcher() throws Exception {
// only load beans from spring once
if (applicationContext == null) {
XmlWebApplicationContext webApplicationContext = new XmlWebApplicationContext();
webApplicationContext.setConfigLocations(getContextLocations());
webApplicationContext.getEnvironment().setActiveProfiles("Prod", "bsi");
webApplicationContext.refresh();
applicationContext = webApplicationContext;
}
servletContext.setAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
applicationContext);
}
JUnit 4
Since you're using JUnit 4 there is StrutsSpringJUnit4TestCase abstract class. Extend it and you can use annotations just like in your SampleTest.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({ "classpath:spring-*.xml" })
@ActiveProfiles(profiles = { "Prod","bsi"})
public class SessionManagement extends StrutsSpringJUnit4TestCase<SomeAction>