当前位置:网站首页>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
边栏推荐
- Binary and decimal system of C language
- Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
- Junit4运行mvn test 测试套件升级方案
- Safety production early warning system software - Download safety production app software
- 每天睡觉前30分钟阅读_day4_Files
- C语言之到底是不是太胖了
- Thinkphp5 how to determine whether a table exists
- Discussion on improving development quality and reducing test bug rate
- 图像识别-数据标注
- 2837xd 代码生成——StateFlow(4)
猜你喜欢
2837xd code generation - Supplement (3)
虚幻——动画蓝图、状态机制作人物走跑跳动作
tinyxml2 读取和修改文件
Mysql索引
Attack and defense world web advanced area unserialize3
2837xd代码生成模块学习(3)——IIC、eCAN、SCI、Watchdog、eCAP模块
2837xd Code Generation - Supplement (1)
2837xd 代码生成——补充(2)
Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
2837xd 代码生成——StateFlow(3)
随机推荐
Error reporting on the first day of work (error reporting when Nessus installs WinPcap)
2837xd 代码生成——补充(1)
每天睡觉前30分钟阅读_day3_Files
JDBC回顾
2837xd代码生成模块学习(3)——IIC、eCAN、SCI、Watchdog、eCAP模块
Image recognition - data annotation
How to choose between efficiency and correctness of these three implementation methods of distributed locks?
每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
Attack and defense world web advanced area unserialize3
2837xd code generation - Supplement (2)
C语言之分草莓
Minimum number of C language
逆变器simulink模型——处理器在环测试(PIL)
2837xd 代码生成——StateFlow(1)
高考那些事
2837xd code generation - stateflow (3)
Save video opencv:: videowriter
2837xd 代码生成——StateFlow(3)
int与string、int与QString互转
Bugkuctf-web16 (backup is a good habit)