Nesting `When` under `When` in `BehaviorSpec` results in silently ignored tests
See original GitHub issueAs illustrated in the sample project, doing something along the lines of:
class DemoTest : BehaviorSpec({
Given("given") {
When("top when") {
When("bottom when") {
Then("assertion") {
1 shouldBe 2
}
}
}
}
})
and the isolation mode set to IsolationMode.InstancePerLeaf
results in all tests passing without execution.
If the isolation mode is left at the default, the outer When
is ignored as not containing any tests/leafs, so also not great.
If I understand correctly, When
s are not supposed to be nested under When
s but it’s something that is very easy to miss when writing or reviewing code, and you end up with silently broken test code.
Is it possible to mitigate this in any way?
Which version of Kotest are you using
5.3.0
Issue Analytics
- State:
- Created a year ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Testing Styles - Kotest
To use Kotest, create a class file that extends one of the test styles. ... Tests can be nested in one or more...
Read more >Introduction to Kotest | Baeldung on Kotlin
Kotest is a multi-platform testing framework written in Kotlin. ... verify actual string is equal to the given string ignoring case result.
Read more >qemu-devel (date) - GNU mailing lists
... [Qemu-devel] [PATCH for-2.5] blkdebug: silence warning under qtest, ... Add test for JSON nesting depth limit, Markus Armbruster, 07:48 ...
Read more >Diff - gerrit - Google Git
Gerrit Daemon -WARNING: At the moment running this configuration results in a ... Unit tests To create run configurations for unit tests, run...
Read more >Analyzing the NYC Subway Dataset - David J. Broadwater
Statistical Test Results. Performing the Mann-Whitney U test on this dataset produced a two-sided p-value of 0.049999825586979442 (just slightly below our ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Kantis I’ve taken the latest snapshot after merging this, and applied it to one of my projects, and tried the above snippet. The nested When is now correctly highlighted as invalid.
Awesome! I must’ve done something wrong when building locally then 😄