springboot创建测试类
1.pom.xml添加依赖<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>
·
1.pom.xml添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
2.创建测试类
@SpringBootTest(classes = Demo2Application.class)
@RunWith(SpringRunner.class)
class Demo2ApplicationTests {
@Test
void test1() {
}
}
注意:如果不行,记得将测试class包名路径改为和启动类一样的路径包名
更多推荐
已为社区贡献4条内容
所有评论(0)