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

Vishnu Shrikar

11/22/2023, 7:53 AM
So the withData() function does not have a parameter for test type, which makes it so it is essentially impossible to register a leaf test in a free spec. This is bad because if someone expects a beforeEach / afterEach to run, they would have to define each test explicity instead of consolidating with withData. The way to fix this is to just have the ability to pass a TestType in to withData instead of hard code it to DYNAMIC. This way a user could pass TEST in and generate proper leaf tests instead of the buggy/broken tests they would get from the DYNAMIC value. I have a friend who ran into this issue and he is willing to contribute it if need be,.
c

Chris Lee

11/22/2023, 10:02 AM
before/after callbacks are supported for data driven tests:
> If you wish to have before / after callbacks in data-driven tests, then you can use the standard beforeTest / afterTest support. Every test created using data-driven testing acts the same way as a regular test, so all standard callbacks work as if you had written all the test by hand.
e

Emil Kantis

11/22/2023, 11:23 AM
v

Vishnu Shrikar

11/22/2023, 3:39 PM
Nice to see the PR is up for release. The problem with beforeAny/afterAny which behave the same behavior as before/after Test, is that I dont want to run the before/after code on my manual non leaf tests other than withData tests. The PR though that is out makes sense, I wonder if a testCase parameter can be taken in to not break other people's codebases... great to see this issue has been looked at though, looking forward to 6.0 release
s

sam

11/22/2023, 4:18 PM
I started removing the test types from junit, I have a PR up with one test left to fix.
If we can get the same thing working in intellij, then we don't need test types at all anymore, and data driven tests can blend in seemlessly anywhere
v

Vishnu Shrikar

11/26/2023, 10:38 PM
Hi sam, I am wondering what you are referring to byt moving the test types, and not needing test types at all anymore. Could you explain further, im not very well versed in all the details
s

sam

11/27/2023, 1:40 PM
It's how the test dsl knows if a test is a leaf or a container. It's defined by the DSL keywords.
2 Views