当前位置:网站首页>Reference to junit5 test framework in gradle
Reference to junit5 test framework in gradle
2022-06-24 15:39:00 【Exclusive rainy days】
Junit5 Is well known recently Junit The test framework .Junit5 It's modular , And it is composed of different modules .
JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage
- JUnit Platform Is in JVM Start the test framework on the basis of .
- JUnit Jupiter It's a combination of a new programming model and an extended model , Used in JUnit 5 Write tests and extensions in .
- JUnit Vintage Provides a TestEngine, Used to run on a platform based on JUnit 3 and JUnit 4 Test of .
stay build.gradle Write the following code to support the operation of Junit Platform
test {
useJUnitPlatform()
}
Can be in useJUnitPlatform See more details in .
Compiling and executing JUnit Jupiter tests
For support Junit Jupiter , You can add the following dependencies
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.1.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.1.0")
}
Then you can write code , And run gradle test To execute .
Executing legacy tests with JUnit Vintage
As previously written , If you want to run Junit3/4, Or the same Jupiter tests Hybrid operation , So we need to introduce JUnit Vintage Engine rely on .
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.1.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.1.0")
testCompileOnly("junit:junit:4.12")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.1.0")
}
Junit Platform Allow different test engines , Junit There are currently two out of the box TestEngine,junit-jupiter-engine and junit-vintage-engine.. Of course, you can customize your own implementation For detailed description, click the link .
By default , All test engines will be used during the test run , But if you want to show the implementation of a specific test engine , You can add the following configuration to achieve Filter specific engines.
tasks.test {
useJUnitPlatform {
includeEngines("junit-vintage")
// excludeEngines("junit-jupiter")
}
}
A test engine filtering sample can be found at samples/testing/junitplatform/engine in the ‘-all’ distribution of Gradle.
Reference documents
边栏推荐
- HMM to CRF understanding and learning notes
- Is industrial securities reliable? Is it safe to open a securities account?
- Which securities company is better and safer for great wisdom to choose when opening an account
- Which account of Dongfang fortune is safer and better
- 期货公司开户安全吗
- Design of CAN bus controller based on FPGA (Part 2)
- Crmeb multi merchant system applet authorization problem solving paste
- Bitmap of redis data structure
- Jenkins 镜像无法更新插件中心的3种解决方法
- Wi-Fi 7 来啦,它到底有多强?
猜你喜欢

MongoDB入門實戰教程:學習總結目錄

VNC Viewer方式的远程连接树莓派

FreeRTOS新建任务不执行问题解决办法

Wi-Fi 7 来啦,它到底有多强?

Do you really know the difference between H5 and applet?

【我的OpenGL学习进阶之旅】OpenGL的坐标系的学习笔记

He is also a junior test engineer. Why is his salary high? The interview must be brilliant at these points
Oracle RAC configuration multipathing

推荐几款超级实用的数据分析利器

Vim编辑器的最常用的用法
随机推荐
Use list
The security market has entered a trillion era, and the security B2B online mall system has been accurately connected to deepen the enterprise development path
个人常用的高效工具
QTreeWidget作为单例模式以dll返回的两个问题
Security Analysis on mining trend of dogecoin, a public cloud
MySQL toolset: the official export tool mysqlpump
Istio practical skill: enable accesslog locally
Fine! Huawei firewall dual computer hot standby Technology: HRP, vgmp, VRRP
【Prometheus】6. Prometheus and kubernetes (incomplete)
The industrial control security of roaming the Intranet
Industry cases of successful digital transformation
Teach you how to view version information with mongodb
In 2021, big companies often ask IOS interview questions -- runloop
Binary computing
Tencent cloud native intelligent data Lake Conference will be held, revealing the panoramic matrix of Tencent cloud data Lake products for the first time
Design of vga/lcd display controller system based on FPGA (Part 2)
update+catroot+c000021a+critical service failed+drivers+intelide+viaide+000000f
SF express: please sign for MySQL soul ten
期货公司开户安全吗
Ethical considerations