Multiple runwith for junit test class

Does anyone know how to handle this.

@RunWith(SpringJUnit4ClassRunner.class) @RunWith(Parametrized.class) @ContextConfiguration("/META-INF/blah-spring-test.xml") public class BlahTest .. 

so I want to have a spring nature test and at the same time I want it to be parameterized to avoid code duplication ...

+7
spring junit annotations
source share
2 answers

You cannot use two runners as indicated in the comments. You should use the Parameterized runner how to use Spring TestContextManager to load Spring context.

 @Before public void before() throws Exception { new TestContextManager(getClass()).prepareTestInstance(this); } 
+4
source share

As with Spring Framework 4.2, JUnit-based integration tests can now be run using JUnit rules instead of SpringJUnit4ClassRunner . This allows Spring-based integration tests with alternative runners like JUnits Parameterized or third-party runners like MockitoJUnitRunner . Read more about spring doc .

0
source share

All Articles