'Are test suites considered deprecated in JUnit5?
I am trying to create test suites with JUnit5. After some research I was not able to conclude whether it is a supported feature or not.
The official user guide only mentions suites with regard to backwards compatibility to JUnit 4.
This is how it was done back in JUnit 4:
@RunWith(Suite.class)
@SuiteClasses({Test1.class, Test2.class})
public class TestSuite {
}
Does this mean, that Test Suites are considered deprecated now, or is the same concept still available under another name?
Solution 1:[1]
Test suits can now be run with JUnit 5 suite engine (from version 5.8.0).
// Aggregator dependency for junit-platform-suite-api and junit-platform-suite-engine
implementation("org.junit.platform:junit-platform-suite:1.8.1")
Here is the code for Kotlin (replace ::class with .class for Java):
import org.junit.platform.suite.api.*
@Suite
@SelectClasses(MyTestClass1::class, MyTestClass2::class)
@SelectPackages("...")
@SelectDirectories("...")
class MyTestSuite
The deprecation of JUnitPlatform runner:
The introduction of @Suite support provided by the junit-platform-suite-engine module makes the JUnitPlatform runner obsolete. See JUnit Platform Suite Engine for details.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
