当前位置:网站首页>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 code generation - Supplement (2)
- 滲透測試的介紹和防範
- 上班第一天的报错(AWVS卸载不彻底)
- Off grid control of three-phase inverter - PR control
- How to handle error logic gracefully
- Judging right triangle in C language
- 2837xd code generation - stateflow (2)
- Int to string, int to qstring
- Mobile mall app solution: how much is it to make an app? Detailed explanation of APP mall development content
- go语言入门
猜你喜欢

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

Mysql索引

Bold prediction: it will become the core player of 5g

2837xd代码生成模块学习(4)——idle_task、Simulink Coder

互联网API接口幂等设计

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

Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)

PI control of three-phase grid connected inverter - off grid mode

Activity的创建和跳转

2837xd 代碼生成——StateFlow(4)
随机推荐
Bugkuctf-web24 (problem solving ideas and steps)
Thinkphp5 how to determine whether a table exists
2837xd代码生成模块学习(2)——ADC、ePWM模块、Timer0
图像识别-数据采集
Skywalking理论与实践
ZK configuration center -- configuration and use of config Toolkit
道阻且长,行则将至
How to choose between efficiency and correctness of these three implementation methods of distributed locks?
MySQL default transaction isolation level and row lock
互联网API接口幂等设计
Save video opencv:: videowriter
C语言之数据插入
PI control of three-phase grid connected inverter - off grid mode
2837xd code generation - Supplement (2)
Alibaba /热门json解析开源项目 fastjson2
高考那些事
分享一篇博客(水一篇博客)
C language programming problems
因上努力,果上随缘
BugkuCTF-web21(详细解题思路及步骤)