0

I have an integration tests class extended from AbstractTestNGSpringContextTests. I want to run test class twice, each time with a different profile programmatically and not by hard-coding profile and configuration xml as below.

@ContextConfiguration(locations = { "classpath:MyBatisBeanConfiguration.xml" })
@ActiveProfiles("cloud")
public class MyIntegrationTests extends AbstractTestNGSpringContextTests
{
  @Test
  public void myTest()
  {
   //do something
  }
}
Manoj Arya
  • 133
  • 5
  • http://stackoverflow.com/a/15245806/180100 might help. –  Jul 03 '13 at 18:01
  • Thanks @RC. Meanwhile I think I need to get into code base of spring test framework and see how it executes the testNG tests with specific profiles. – Manoj Arya Jul 12 '13 at 12:26

1 Answers1

0

You can use the VM argument spring.profiles.active to enable certain spring profile(s) in your tests (or any other application for that matter).

Example: -Dspring.profiles.active=cloud,someOtherProfile

hupfis
  • 128
  • 7