@SpringBootTest: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=External= | |||
* https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/context/SpringBootTest.html | |||
=Internal= | =Internal= | ||
Line 6: | Line 10: | ||
@SpringBootTest tells to SpringRunner, which is a JUnit plugin that provides custom Spring-specific testing behavior, to bootstrap the test with Spring Boot capabilities: | @SpringBootTest tells to SpringRunner, which is a JUnit plugin that provides custom Spring-specific testing behavior, to bootstrap the test with Spring Boot capabilities: | ||
* load [[ | * load [[application.properties]] | ||
* etc. | * etc. | ||
Line 12: | Line 16: | ||
@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The @SpringBootTest annotation also has a properties attribute that can be used to specify any additional properties that should be defined in the environment. Properties are now loaded in the exact same way as Spring’s regular [[@TestPropertySource]] annotation. |
Latest revision as of 23:40, 21 November 2018
External
Internal
Overview
@SpringBootTest tells to SpringRunner, which is a JUnit plugin that provides custom Spring-specific testing behavior, to bootstrap the test with Spring Boot capabilities:
- load application.properties
- etc.
@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)
The @SpringBootTest annotation also has a properties attribute that can be used to specify any additional properties that should be defined in the environment. Properties are now loaded in the exact same way as Spring’s regular @TestPropertySource annotation.