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

边栏推荐
- 大学生四六级作文模板(自创版,成功跨过六级)
- The road is blocked and long, and the line is coming
- c语言编程题
- Record personal understanding and experience of game console configuration
- Read 30 minutes before going to bed every day_ day4_ Files
- Read 30 minutes before going to bed every day_ day3_ Files
- Fragmenttabhost implements the interface of housing loan calculator
- 2837xd 代碼生成——StateFlow(4)
- Bugkuctf-web24 (problem solving ideas and steps)
- 2837xd 代码生成——StateFlow(4)
猜你喜欢

High level application of SQL statements in MySQL database (II)

2837xd code generation - Supplement (2)

个人经历&&博客现状

Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)

Image recognition - data augmentation

并网逆变器PI控制(并网模式)

web安全与防御

Read 30 minutes before going to bed every day_ day4_ Files

MySQL事务

Matlab生成dsp程序——官方例程学习(6)
随机推荐
Matlab生成dsp程序——官方例程学习(6)
互联网API接口幂等设计
QT QLabel样式设置
Tinyxml2 reading and modifying files
图像识别-数据清洗
上班第一天的报错(AWVS卸载不彻底)
Hystrix implements request consolidation
The latest progress and development trend of 2022 intelligent voice technology
Error reporting on the first day of work (error reporting when Nessus installs WinPcap)
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
阿里云SLS日志服务
分享一篇博客(水一篇博客)
攻防世界-Web进阶区-unserialize3
2837xd 代码生成——补充(1)
Summary of demand R & D process nodes and key outputs
每天睡前30分钟阅读Day5_Map中全部Key值,全部Value值获取方式
记录下对游戏主机配置的个人理解与心得
BugkuCTF-web21(详细解题思路及步骤)
保存视频 opencv::VideoWriter
kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)