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

边栏推荐
- 2837xd 代码生成——补充(1)
- Tools used for Yolo object recognition and data generation
- Matlab代码生成之SIL/PIL测试
- 攻防世界-Web进阶区-unserialize3
- How to use PHP spoole to implement millisecond scheduled tasks
- 保存视频 opencv::VideoWriter
- 阿里云短信服务
- 2837xd 代码生成——StateFlow(2)
- 2837xd code generation - Supplement (3)
- Error reporting on the first day of work (error reporting when Nessus installs WinPcap)
猜你喜欢

Memories of a chat

Image recognition - data augmentation

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

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

ZK configuration center -- configuration and use of config Toolkit

Activity的创建和跳转

MySQL default transaction isolation level and row lock

Mysql默认事务隔离级别及行锁

PI control of grid connected inverter (grid connected mode)

Bold prediction: it will become the core player of 5g
随机推荐
QT qlabel style settings
C语言之分草莓
因上努力,果上随缘
C language programming problems
Vs+qt set application icon
2837xd code generation module learning (4) -- idle_ task、Simulink Coder
2837xd 代码生成——StateFlow(3)
Share a blog (water blog)
How to choose between efficiency and correctness of these three implementation methods of distributed locks?
Mysql索引
Read 30 minutes before going to bed every day_ day4_ Files
Idempotent design of Internet API interface
Required request body is missing:(跨域问题)
阿里云SLS日志服务
C language: making barrels
Personal experience & blog status
How to use pyqt5 to make a sensitive word detection tool
Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
一次聊天勾起的回忆
2837xd code generation - stateflow (1)