简体   繁体   中英

Custom Filter Chain for TestClasses?

I'm using spring-boot and @WebIntegrationTest to run some Selenium tests. I'm trying to figure out how to add/remove some filters for my test cases.

I've gone over the docs a few times and have not been able to find a way to do this. Is it possible?

Please note: I am not using mockMvc and for these test cases we do not want to.

See Reference Spring Boot docs how to register or disable servlet filters. To register one, just implement Filter interface and register it with @Bean annotation.

But , my understanding is that Selenium testing should test application as black box and shouldn't mix testing context with production context. Optionally this testing can happen against production environment.

Personally would include one or two sanity tests into application build itself to make sure it's working end to end. But I wouldn't mix contexts anyway.

Otherwise I would place all the tests into separate project firing requests against PROD or continuous delivery environment.

BTW, I highly recommend looking into Page Object pattern when doing Selenium testing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM