文章目录
Spring Boot Test 系列1 - 入门
前言
本文为Spring Boot Test系列的第一篇的入门文章。
工具:
- Intellij IDEA Ultimate
- Spring Boot 2.4.0
- JUnit5 (Spring Boot Test 2.4.0默认为JUnit5)
- Maven
- Java 8+
创建Spring Boot项目
在Intellj中使用Spring Initialzr向导创建Spring Boot项目。
选择Spring Boot 2.4,并选择:
- Developer Toools
- Spring Boot DevTools
- Lombok
- Web
- Spring Web
默认包含了Spring Boot Starter Test模块。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
参见:
Spring Boot Starter Test依赖
运行mvn dependency:tree
查看依赖,其中Spring Boot Starter Test的依赖如下:
\- org.springframework.boot:spring-boot-starter-test:jar:2.4.0:test
+- org.springfra