Explicit Test Names
Last updated
Last updated
For dynamic tests, Konsist can't obtain the current test's name. Test name may be correctly displayed in the IDE, however, the testName
argument should be provided to enable:
Correct test names are displayed in the log when the test is failing
Test suppression (See Suppress Konsist Test)
The testName
argument should be passed to assertX
methods such as assertTrue
, assertFalse
etc. Let's look at the code:
Here is the summary of test frameworks:
JUnit4
static
Not required
JUnit5
static
Not required
JUnit5
dynamic
Recommended
Kotest
dynamic
Recommended
Here is a concrete implementation passing he testName
argument for each test Framework:
introduced native support for dynamic tests, however, it also supports static tests. For static test testName
does not have to be passed as it can be internally retrieved by Konsist.
provides robust support for dynamic tests, allowing developers to define test cases programmatically at runtime, making it a flexible alternative to traditional JUnit testing. It is recommended to utilize the name derived from the Kotest (this.testCase.name.testName
) context as the value for the testName
argument:
does not natively support dynamic tests; tests in this framework are typically static and determined at compile-time, so there is no need to pass testName
argument.