TestExecutionListener
hassas bir uygulama kullanmam gerekirse, varsayılan TestExecutionListeners yüklenmesini engeller. benim test sınıf yalnızca yüklü Dinleyici olacakBir TestExecutionListener Ekleme
@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({MyCustomTestExecutionListener.class})
@ContextConfiguration(locations = { "classpath:test-ApplicationContext.xml" })
public class CabinetMembershipServiceImplTest {
...
}
MyCustomTestExecutionListener
gibidir ve benim testleri yürütülmesi başarısız yaparsa. Ben herhangi bir TestExecutionListener belirterek whitout benim testleri başlatmak ve ben Bahar 'günlüklerde kazmak zaman
, ben bulabilirsiniz:
getDefaultTestExecutionListenerClassNames : Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
benim TestExecutionListener eklemek istiyorsanız Yani, bir ek olarak (belirtmeniz gerekir istenen uygulama) benim test sınıfında tüm bu varsayılan TestExectionListeners:
@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
ServletTestExecutionListener.class,
DirtiesContextBeforeModesTestExecutionListener.class,
DependencyInjectionTestExecutionListener.class,
DirtiesContextTestExecutionListener.class,
TransactionalTestExecutionListener.class,
SqlScriptsTestExecutionListener.class,
MyCustomTestExecutionListener.class})
@ContextConfiguration(locations = { "classpath:test-ApplicationContext.xml" })
public class CabinetMembershipServiceImplTest {
...
}
sadece) TestExecutionListener birini (veya daha fazla ekleme bir yolu açıkça her Liste bildirmek zorunda whithout var mı varsayılan yapılandırmadan ne de varsayılan olanları "geçersiz kılar"?