xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>注释
- 添加到类上
@SpringBootTest表示这是一个测试类
- 添加到方法上
@Test表示这是一个测试方法
java
@RunWith(SpringRunner.class)
@SpringBootTest
public class AppTest {
@Value("${ChatBot-api.groupId}")
private String groupId;
@Value("${ChatBot-api.cookie}")
private String cookie;
@Autowired
private ZsxqApi zsxqApi;
@Test
public void Test() throws IOException {
zsxqApi.getWithoutCommentsTopics(groupId, cookie);
}
}