I have a weird Spring issue with Kotest, when I run a test which uses the SpringExtension individually it works, but when I run the entire suite, it loads (I think) an application context only once and reuses it, causing some tests to fail. I only have ContextConfiguration and other sliced annotations wanting to minimize the application context for each test. I tried adding
@DirtiesContext
but to no avail. Any thoughts?
Davio
10/24/2022, 10:21 AM
I think it might have had to do with
@AutoConfigureWireMock
from Spring Cloud contract's dependency, I replaced it with the Kotest Wiremock extension
o
Olek Brzozowski
10/25/2022, 8:09 PM
Yes, you probably have to clear the invocations / stubs in wiremock after every test, and as far as I know this is handled by the wiremock extensions.
Be aware of dirties context - this solution is more costly than clearing the data in database or reseting the state of wiremock. You should rather avoid using it, unless you really need it 🙂
d
Davio
10/26/2022, 11:23 AM
I replaced it with the Kotest Wiremock extension, now it works, I think the other one just leaves some stuff behind