I want the test to report all assertions and verifications. So both the mockk
verification AND the the assertion library (in this case, KotlinTest
) assertions should run and not shortcircuit.
In other words I don't want the test to stop ...
verify(exactly = 1) { mock.methodcall(any()) } // ... here
success shouldBe true // how can I check this line too
nor ...
success shouldBe true // ... here
verify(exactly = 1) { mock.methodcall(any()) } // how can I check this line too
How to do this? I am open to use just one tool if I can do both with it.
As per your comment, you said you are using
KotlinTest
.In KotlinTest, I believe you can use
assertSoftly
for the behavior you want:And then, we can convert your test to use
assertSoftly
:It's necessary to wrap
verify
inshouldNotThrowAny
to makeassertSoftly
aware of it when it throws an exception