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

边栏推荐
- Image recognition - data augmentation
- Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
- 道阻且长,行则将至
- zk配置中心---Config Toolkit配置与使用
- 2837xd代码生成模块学习(3)——IIC、eCAN、SCI、Watchdog、eCAP模块
- Error reporting on the first day of work (error reporting when Nessus installs WinPcap)
- 2837xd代码生成模块学习(2)——ADC、ePWM模块、Timer0
- JDBC review
- BugkuCTF-web24(解题思路及步骤)
- What is the function of laravel facade
猜你喜欢

Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime

The latest progress and development trend of 2022 intelligent voice technology

Operation and application of stack and queue

个人经历&&博客现状

Fragmenttabhost implements the interface of housing loan calculator

2837xd code generation - Summary

Introduction et prévention des essais de pénétration

ESLint 报错

c语言编程题

Read 30 minutes before going to bed every day_ day4_ Files
随机推荐
2837xd code generation - Supplement (1)
2837xd code generation - stateflow (1)
go语言入门
Web security and defense
Ckeditor 4.10.1 upload pictures to prompt "incorrect server response" problem solution
2837xd Code Generation - Supplement (1)
Judging right triangle in C language
[ue5] animation redirection: how to import magic tower characters into the game
上班第一天的报错(Nessus安装winpcap报错)
Bold prediction: it will become the core player of 5g
2837xd code generation - Supplement (3)
2837xd 代码生成——补充(3)
职业规划和发展
Data insertion in C language
Memories of a chat
c语言编程题
QT信号槽总结-connect函数错误用法
Matlab代码生成之SIL/PIL测试
Read Day5 30 minutes before going to bed every day_ All key values in the map, how to obtain all value values
每天睡觉前30分钟阅读_day4_Files