springboottest官方文档:https://docs.spring.io/spring-boot/docs/1.5.9.RELEASE/reference/htmlsingle/#boot-features-test-scope-dependencies
gradle+spring
IDEA:IntelliJ
.gradle配置:testImplementation 'junit:junit:4.11'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
debug fail 报 initializationError
改正:看报错文案,是Junit版本过低造成,把版本由4.11 改为4.12 再次运行就好了
改正后:testImplementation 'junit:junit:4.12'
先检查Junit和hamcrest-all是否在gradle里面配置了,若都配置了,看报错文案,找详细错误点。
借鉴链接:
1、https://www.cnblogs.com/josonwong/p/4092732.html
2、https://blog.csdn.net/hanpompy/article/details/7622251