I'm trying to specify a custom test execution listener, and my code looks something like this:
Code:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext.xml"})
@TestExecutionListeners(MyListener.class)
public class RandomTest
{
@Autowired
ApplicationContext ctx;
However, it appears that the TestExecutionListeners annotation removes all of the default annotations. Thus, by specifying one listener of my own I loose the DependencyInjectionTestExecutionListener that is normally provided. (Therefore, the variable "ctx" is always null.)
My questions are:
- Is there a way to add a test execution listener without loosing the ones that are normally provided?
- Are there any "gotchas" when dealing with the DirtiesContext or Transactional annotations while specifying a custom test execution listener?
Thanks!