当前位置:网站首页>Junit4 runs MVN test test suite upgrade scheme
Junit4 runs MVN test test suite upgrade scheme
2022-07-02 09:54:00 【Don't talk about Xiao Li】
background :
Included in the project junit4( Introduce... Independently ) and junit5(spring-boot-starter-parent 2.5.4 Bring your own version )
Currently we use springboot 3.5.4 Self contained maven-surefire-plugin Version is :2.22.2
The loading logic is as follows : According to junit5 Rule lookup test , But we suit The kit uses junit4 edition , Cause the unit test not found exception .
if the JUnit 5 Platform Engine is present in the project
use junit-platform
if the JUnit version in the project >= 4.7 and the <<<parallel>>> configuration parameter has ANY value
use junit47 provider
if JUnit >= 4.0 is present
use junit4 provider
else
use junit3.8.1
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
Abnormal information :
Execution quantity is 0:[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
perhaps mvn -Dtest=TestSuiteOne test
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project wdseller-web: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
Solution :
- First option : Global upgrade to junit5
- Second option : Appoint maven-surefire-plugin To an old version
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>com.wdtrip.seller.controller.TestSuiteOne</include>
</includes>
</configuration>
</plugin>Other :suit Suite execution method
- mvn -Dtest=TestSuiteOne test ( Pass the specified test suit, Direct execution )
- Above pom To configure maven-surefire-plugin Of include after , Direct execution mvn test , The effect is the same
Reference documents :
Official documents :Maven Surefire Plugin – Using JUnit
Why Your JUnit 5 Tests Are Not Running Under Maven - Spring Framework Guru

边栏推荐
- Record the interesting process of using Xray for the first time
- Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
- What are the differences between TP5 and laravel
- Junit5 支持suite的方法
- Kinect DK obtains color RGB images in cv:: mat format (used in openpose)
- 保存视频 opencv::VideoWriter
- 2837xd 代码生成——补充(1)
- C language: making barrels
- MySQL事务
- CKEditor 4.10.1 上传图片提示“不正确的服务器响应” 问题解决
猜你喜欢

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

Creation and jump of activity

【UE5】蓝图制作简单地雷教程

Image recognition - data annotation

2837xd 代码生成——补充(2)

Image recognition - data augmentation

每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime

Operation and application of stack and queue

In SQL injection, why must the ID of union joint query be equal to 0

Mysql默认事务隔离级别及行锁
随机推荐
2837xd code generation - Summary
记录下对游戏主机配置的个人理解与心得
Int to string, int to qstring
2837xd Code Generation - Supplement (1)
Ckeditor 4.10.1 upload pictures to prompt "incorrect server response" problem solution
The road is blocked and long, and the line is coming
C language strawberry
Matlab生成dsp程序——官方例程学习(6)
Learn combinelatest through a practical example
【UE5】蓝图制作简单地雷教程
Creation and jump of activity
每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
并网逆变器PI控制(并网模式)
Thinkphp5 how to determine whether a table exists
BugkuCTF-web24(解题思路及步骤)
2837xd 代码生成——补充(3)
Idempotent design of Internet API interface
C语言之判断直角三角形
2837xd 代码生成——总结篇
Kinect DK obtains color RGB images in cv:: mat format (used in openpose)