Join Slack
Menu
Home
Archive
Hey all, is there any alternative to `mockkStatic` ? I'm having issues when running tests in parall...
# mockk
m
MSC
09/14/2022, 9:31 PM
Hey all, is there any alternative to
mockkStatic
? I'm having issues when running tests in parallel due to mocking using
mockkStatic
The only way I've managed to make it work was with
@Isolated
annotation at the top of each test class. TIA
e
ephemient
09/14/2022, 9:40 PM
since you mention
@Isolated
I'll assume you're using JUnit 5
ephemient
09/14/2022, 9:41 PM
in which case: no, there isn't
ephemient
09/14/2022, 9:42 PM
in principle, running each test in a separate classloader would prevent leaking static state (such as
mockkStatic
) between them. but while there were ways of achieving that in JUnit 4, there are not in JUnit 5.
https://github.com/junit-team/junit5/issues/201
m
MSC
09/14/2022, 9:56 PM
hmm bugger! Ok thanks
@ephemient
🙏
229
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by