https://kotlinlang.org logo
#kotest
Title
# kotest
j

johnaqel

07/01/2021, 2:50 AM
Hi everyone, I’m facing an interesting situation where I’m using Kotest assertions with Junit5 and Testcontainers. If I have a test function that contains a call to shouldThrow or shouldThrowAny, then that function is no longer being recognised as a test. If I run the enclosing test class then all test functions will be run except those that contain shouldThrow/Any and if I run the test against that function specifically I get a “No tests found for given includes:” Does anyone know what could cause such a thing where including shouldThrow no longer makes a function recognisable as a test?
s

Sourabh Rawat

07/01/2021, 9:31 AM
can you share your test file?
j

johnaqel

07/02/2021, 1:47 AM
@Sourabh Rawat I’ll probably need to setup a demo project before sharing code as the current code is commercial.
I was hoping it’s a well known issue, but doesn’t look like it is. I have an ugly work around for now. But I’ll dig a little deeper in my free time and try to set up a small gradle build that demonstrates the issue.
s

Sourabh Rawat

07/02/2021, 1:55 AM
Yeah. Never heard of such kind of issue before. It also depends on the spec style and where you are putting the code in it. Like behaviourspec can behave "in unexpected way" if you don't know how it works properly.
j

johnaqel

07/02/2021, 10:20 PM
@Sourabh Rawat I’m actually using JUnit5. I’m only using Kotest assertions core module.