What about testing static content against a full blown server?
Here is a sample application to show what I'm talking about.
The entry point for such tests is a @LeanWebTest annotation:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {
MvcConfig.class,
WebSecurityConfig.class
})
@EnableAutoConfiguration(exclude = {
DataSourceAutoConfiguration.class,
JpaRepositoriesAutoConfiguration.class
})
@Retention(RetentionPolicy.RUNTIME)
public @interface LeanWebTest {
}
@LeanWebTest is a @SpringBootTest using a fully configured server at random port.
It specifies the following @Configuration classes:
Spring Security overrides Cache-Control headers. Probably it is not what we might want especially with static resources.
See also: How to enable HTTP response caching in Spring Boot
@LeanWebTest does not use any @Beans from the application except of specified configuration classes. (No @Controllers created)
I see the following aspects applicable to @LeanWebTests:
robots.txt file
javax.servlet.Filters
- static resources compression
- static resources caching
- etc..
The sample application has some tests:
Please note that the project is a rough demonstration of the concept