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

边栏推荐
- 【UE5】动画重定向:如何将幻塔人物导入进游戏玩耍
- Mysql默认事务隔离级别及行锁
- Alibaba / popular JSON parsing open source project fastjson2
- 2837xd Code Generation - stateflow (4)
- 2837xd 代码生成——StateFlow(1)
- C language: making barrels
- Introduction et prévention des essais de pénétration
- Inverter Simulink model -- processor in the loop test (PIL)
- Tools used for Yolo object recognition and data generation
- C语言之做木桶
猜你喜欢

Save video opencv:: videowriter

BugkuCTF-web24(解题思路及步骤)

2837xd code generation - stateflow (2)

Error reporting on the first day of work (incomplete awvs unloading)

在SQL注入中,为什么union联合查询,id必须等于0

Read 30 minutes before going to bed every day_ day4_ Files

Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd

Typora installation package sharing

Bugkuctf-web21 (detailed problem solving ideas and steps)

Idempotent design of Internet API interface
随机推荐
2837xd code generation - Summary
QT信号槽总结-connect函数错误用法
Safety production early warning system software - Download safety production app software
大学生四六级作文模板(自创版,成功跨过六级)
Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
2837xd 代碼生成——補充(1)
2837xd代码生成模块学习(2)——ADC、ePWM模块、Timer0
2837xd code generation - Supplement (2)
QT QLabel样式设置
图像识别-数据清洗
Record the interesting process of using Xray for the first time
XA Transaction SQL Statements
Vs+qt set application icon
Learn combinelatest through a practical example
Alibaba /热门json解析开源项目 fastjson2
2837xd Code Generation - stateflow (4)
每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
记录一下初次使用Xray的有趣过程
How to install PHP in CentOS
Minimum number of C language