Hi :wave: , I’ve just updated my Kotest dependenci...
# kotest
p
Hi 👋 , I’ve just updated my Kotest dependencies from 4.6.3 to 5.3.0 and found that my
beforeAll
function has some issues that I need to fix:
Copy code
override fun beforeAll() {  // beforeAll is deprecated
        super.beforeAll()
        readConfig()
        RuntimeTagExpressionExtension.expression = tags  // Unresolved reference: RuntimeTagExpressionExtension
        ....
readConfig()
reads some values from a config file including the tags string, which is then set in
RuntimeTagExpressionExtension
but this seems to not exist in the new Kotest version This was working fine on the old version, but what is the correct way to do this with the new version? Am I correct to change the function as below?
Copy code
override suspend fun beforeProject() {
        super.beforeProject()
        ....
I also have a similar issue with
afterAll
s
Where was the beforeAll - was this in your proejct config ?
p
Yes it’s inside my
AbstractProjectConfig
s
Yeah that became suspendable in 5.x
Copy code
RuntimeTagExpressionExtension
exists but moved package but it looks like the inner value is private 🤦🏻‍♂️
You should be able to do something like
override fun extensions() = listOf(RuntimeTagExpressionExtension(tags))
inside your project config class
p
Ok I’ll try that 🙏
That worked fine but I noticed
extensions()
is called before
beforeProject()
so I had to do it like this to get the tags first:
Copy code
override fun extensions(): List<RuntimeTagExpressionExtension> {
        readConfig()
        return listOf(RuntimeTagExpressionExtension(tags))
    }
Has the way the tagging works changed in 5.x? Gradle is reporting a higher number of total tests, which isn’t a problem because it’s only running the tests that it’s supposed to, but I just wondered if that was due to another change in Kotest
s
It might be that the test reporting is including parent tests of child tests.
if the right tests are running then tagging should be good (and it shouldn't have changed from a user perspective, but of course there's always a chance of a bug)
p
The tagging seems to be working fine, it just looks like a difference in the way gradle is reporting it I have some tests in different folders, and only controlling which ones run with tags, so I think with 4.x gradle wasn’t including any packages/classes where all of the tests are ignored in its report, but after changing to 5.3.0 those are included in the report It’s not a problem though, just something I noticed 🙂
s
5.3.0 uses a later version of junit which has some bugs fixed around nested tests
👍 1
p
Cool, thanks again for the help with this 👍
👍🏻 1