办学质量监测教学评价系统
ageer
2024-04-01 dea23f13ef2d4918080ce8aeee1ee908188cdb19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.xmzs.test;
 
import com.xmzs.common.core.config.RuoYiConfig;
import org.junit.jupiter.api.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
 
import java.util.concurrent.TimeUnit;
 
/**
 * 单元测试案例
 *
 * @author Lion Li
 */
@SpringBootTest // 此注解只能在 springboot 主包下使用 需包含 main 方法与 yml 配置文件
@DisplayName("单元测试案例")
public class DemoUnitTest {
 
    @Autowired
    private RuoYiConfig ruoYiConfig;
 
    @DisplayName("测试 @SpringBootTest @Test @DisplayName 注解")
    @Test
    public void testTest() {
        System.out.println(ruoYiConfig);
    }
 
    @Disabled
    @DisplayName("测试 @Disabled 注解")
    @Test
    public void testDisabled() {
        System.out.println(ruoYiConfig);
    }
 
    @Timeout(value = 2L, unit = TimeUnit.SECONDS)
    @DisplayName("测试 @Timeout 注解")
    @Test
    public void testTimeout() throws InterruptedException {
        Thread.sleep(3000);
        System.out.println(ruoYiConfig);
    }
 
 
    @DisplayName("测试 @RepeatedTest 注解")
    @RepeatedTest(3)
    public void testRepeatedTest() {
        System.out.println(666);
    }
 
    @BeforeAll
    public static void testBeforeAll() {
        System.out.println("@BeforeAll ==================");
    }
 
    @BeforeEach
    public void testBeforeEach() {
        System.out.println("@BeforeEach ==================");
    }
 
    @AfterEach
    public void testAfterEach() {
        System.out.println("@AfterEach ==================");
    }
 
    @AfterAll
    public static void testAfterAll() {
        System.out.println("@AfterAll ==================");
    }
 
}