当前位置:网站首页>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

边栏推荐
猜你喜欢

zk配置中心---Config Toolkit配置与使用

记录一下初次使用Xray的有趣过程

kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)

How to use PHP spoole to implement millisecond scheduled tasks

ZK configuration center -- configuration and use of config Toolkit

图像识别-数据清洗

PI control of grid connected inverter (grid connected mode)

每天睡觉前30分钟阅读_day4_Files

2837xd 代码生成——StateFlow(3)

Beats (filebeat, metricbeat), kibana, logstack tutorial of elastic stack
随机推荐
FragmentTabHost实现房贷计算器界面
BugkuCTF-web16(备份是个好习惯)
QT QLabel样式设置
ZK configuration center -- configuration and use of config Toolkit
C语言之最小数
Inverter Simulink model -- processor in the loop test (PIL)
2837xd 代码生成——StateFlow(4)
每天睡前30分钟阅读Day5_Map中全部Key值,全部Value值获取方式
How to use pyqt5 to make a sensitive word detection tool
Kinect DK obtains color RGB images in cv:: mat format (used in openpose)
Personal experience & blog status
攻防世界-Web进阶区-unserialize3
2837xd code generation - Supplement (1)
How to install PHP in CentOS
Ckeditor 4.10.1 upload pictures to prompt "incorrect server response" problem solution
TD conducts functional simulation with Modelsim
QT qlabel style settings
2837xd 代碼生成——補充(1)
Junit5 支持suite的方法
Read 30 minutes before going to bed every day_ day3_ Files