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

边栏推荐
- vs+qt 设置应用程序图标
- Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
- 2837xd code generation - Supplement (2)
- What is the function of laravel facade
- 记录下对游戏主机配置的个人理解与心得
- 2837xd代码生成模块学习(2)——ADC、ePWM模块、Timer0
- 2837xd Code Generation - Supplement (1)
- 每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
- BugkuCTF-web16(备份是个好习惯)
- Web security and defense
猜你喜欢

TD conducts functional simulation with Modelsim

Memories of a chat

MySQL default transaction isolation level and row lock

每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime

2837xd code generation - stateflow (2)

Required request body is missing:(跨域问题)

tinyxml2 读取和修改文件

2837xd 代碼生成——補充(1)

2837xd code generation - stateflow (3)

2837xd 代码生成——StateFlow(3)
随机推荐
What is the function of laravel facade
Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
How to use PHP spoole to implement millisecond scheduled tasks
渗透测试的介绍和防范
Activity的创建和跳转
Bold prediction: it will become the core player of 5g
Supplier selection and prequalification of Oracle project management system
Mixed development of uni app -- Taking wechat applet as an example
每天睡觉前30分钟阅读_day3_Files
Junit4运行mvn test 测试套件升级方案
2837xd 代码生成——StateFlow(2)
[ue5] animation redirection: how to import magic tower characters into the game
2837xd code generation - stateflow (4)
C语言之分草莓
Because of hard work, the fruit goes with fate
go语言入门
Save video opencv:: videowriter
MySQL transaction
在SQL注入中,为什么union联合查询,id必须等于0