当前位置:网站首页>Junit5 supports suite methods
Junit5 supports suite methods
2022-07-02 09:54:00 【Don't talk about Xiao Li】
background :
Some unit tests don't want to be executed automatically , Only some unit tests are expected to be on the intranet http://10.0.0.65/ Automatically run on the server , So I want to configure suite To solve some implementation problems .
(junit5 There is no in the lower version suite, At present, we springboot Default with junit5 Need to upgrade )
Benefits :
- mvn test Execute only some core selected unit tests
- Unit tests can be managed in groups
- Arrange the sequence of the test room
Method :
1. stay web Introduce... Into the application junit5
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.8.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>2. introduce suite My bag
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-engine</artifactId>
</dependency>3. Code using suite
package com.wdtrip.wdpromotion;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@Suite
@SelectClasses({TestCustomPage.class,
TestEbkActivity.class
})
public class TestSuiteOne {
}
4. stay pom Of documents build Configure what needs to be executed suite
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>com.wdtrip.wdpromotion.TestSuiteOne</include>
</includes>
</configuration>
</plugin>junit5 Unit test sequence arrangement
See documentation :java - Does JUnit 5 support test method execution in alphabetical order or any similar functionality? - Stack Overflow
By method name :MethodOrderer.MethodName.class
Follow the order of your notes :@TestMethodOrder(OrderAnnotation.class) , On the way @Order(1)
IDEA Git Tool integration test function
If you use git Tool submission code , You can set before cmmit When executing a unit test set

边栏推荐
- 阿里云ack介绍
- Image recognition - Data Cleaning
- 阿里云短信服务
- Bugkuctf-web16 (backup is a good habit)
- Kinect DK obtains color RGB images in cv:: mat format (used in openpose)
- Save video opencv:: videowriter
- 2837xd Code Generation - Supplement (1)
- Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
- C language strawberry
- Idempotent design of Internet API interface
猜你喜欢

Read 30 minutes before going to bed every day_ day4_ Files

2837xd code generation - Supplement (2)

PI control of three-phase grid connected inverter - off grid mode

Junit5 支持suite的方法

图像识别-数据清洗

Attack and defense world web advanced area unserialize3

2837xd code generation - stateflow (2)

Image recognition - Data Cleaning

渗透测试的介绍和防范

QT qlabel style settings
随机推荐
Error reporting on the first day of work (error reporting when Nessus installs WinPcap)
int与string、int与QString互转
C语言之数据插入
Skywalking理论与实践
[ue5] animation redirection: how to import magic tower characters into the game
c语言编程题
vs+qt 设置应用程序图标
Record personal understanding and experience of game console configuration
图像识别-数据标注
Required request body is missing: (cross domain problem)
Typora安装包分享
2837xd 代码生成——StateFlow(4)
Fragmenttabhost implements the interface of housing loan calculator
2837xd 代碼生成——StateFlow(4)
Bugkuctf-web16 (backup is a good habit)
Tools used for Yolo object recognition and data generation
Bugkuctf-web24 (problem solving ideas and steps)
Junit4运行mvn test 测试套件升级方案
阿里云Prometheus监控服务
大学生四六级作文模板(自创版,成功跨过六级)