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

边栏推荐
猜你喜欢

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

阿里云ack介绍

C language programming problems

TD联合Modelsim进行功能仿真

Typora安装包分享

QT qlabel style settings

2837xd code generation - Supplement (2)

图像识别-数据清洗

How to use PHP spoole to implement millisecond scheduled tasks

2837xd 代码生成——StateFlow(1)
随机推荐
int与string、int与QString互转
滲透測試的介紹和防範
Memories of a chat
YOLO物体识别,生成数据用到的工具
图像识别-数据标注
互联网API接口幂等设计
阿里云ack介绍
C语言之数据插入
Ckeditor 4.10.1 upload pictures to prompt "incorrect server response" problem solution
Discussion on improving development quality and reducing test bug rate
C language strawberry
2837xd 代码生成——补充(3)
C语言之做木桶
Required request body is missing: (cross domain problem)
What are the differences between TP5 and laravel
2837xd 代码生成——StateFlow(4)
Alibaba cloud SLS log service
渗透测试的介绍和防范
逆变器simulink模型——处理器在环测试(PIL)
大学生四六级作文模板(自创版,成功跨过六级)