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

边栏推荐
- Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)
- Junit5 支持suite的方法
- 分享一篇博客(水一篇博客)
- 2837xd 代码生成——StateFlow(1)
- 攻防世界-Web进阶区-unserialize3
- vs+qt 设置应用程序图标
- What is the function of laravel facade
- 阿里云短信服务
- C语言之最小数
- Kinect DK obtains color RGB images in cv:: mat format (used in openpose)
猜你喜欢

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

PI control of grid connected inverter (grid connected mode)

Mysql索引

2837xd code generation - stateflow (1)

滲透測試的介紹和防範

图像识别-数据标注

Required request body is missing:(跨域问题)

2837xd code generation - Supplement (2)

Fragmenttabhost implements the interface of housing loan calculator

JDBC回顾
随机推荐
BugkuCTF-web21(详细解题思路及步骤)
Mysql默认事务隔离级别及行锁
Skywalking理论与实践
2837xd code generation - stateflow (4)
C语言之数据插入
阿里云SLS日志服务
Bugkuctf-web21 (detailed problem solving ideas and steps)
【UE5】蓝图制作简单地雷教程
In SQL injection, why must the ID of union joint query be equal to 0
PI control of three-phase grid connected inverter - off grid mode
攻防世界-Web进阶区-unserialize3
2837xd code generation - Summary
图像识别-数据标注
Web security and defense
JDBC回顾
C语言之分草莓
How to handle error logic gracefully
QT signal slot summary -connect function incorrect usage
Typora installation package sharing
Read Day5 30 minutes before going to bed every day_ All key values in the map, how to obtain all value values