huehnerlady
10/22/2020, 3:06 PMobject KotestConfig : AbstractProjectConfig() {
override val isolationMode = IsolationMode.InstancePerTest
override fun listeners() = listOf(SpringListener)
}
But when I set a break point in a test I can see that isolationMode is actually null. Also tried to use the deprecated function, same result.
I can also see that the mode is not working as I have one test bleeding into the other.
With the listeners it seems to work as the Spring tests are running without having the spring listener added
Any idea what I am doing wrong?wasyl
10/22/2020, 3:08 PMio.kotlintest.provided
package? Not sure how it exactly works after the auto-discovery changes, but it’s what we have and it seems to worksam
10/22/2020, 3:08 PMhuehnerlady
10/22/2020, 3:09 PMsam
10/22/2020, 3:10 PMclass KotestConfig : AbstractProjectConfig() {
override val isolationMode = IsolationMode.InstancePerTest
override fun listeners() = listOf(SpringListener)
}
huehnerlady
10/22/2020, 3:11 PMsam
10/22/2020, 3:15 PMhuehnerlady
10/22/2020, 3:15 PMsam
10/22/2020, 3:16 PMwasyl
10/22/2020, 3:46 PMInstancePerTest
is different from InstancePerLeaf
, which I find the most intuitive and consistent with plain JUnit. PerTest runner will run each test, even a container, in a separate Spec instance. PerLeaf runner will create an instance per lowest-level container, one that typically contains assertions (e.g. it
in a DescribeSpec
). Perhaps you could post a sample test with print statements and output that you expect vs what you seehuehnerlady
10/22/2020, 3:48 PMdescribe("tests") {
it("should fail") {
listOf("someString") shouldBe emptyList()
}
}
In my opinion this test should fail, but it actually passes. That made me think there must be some mock return bleeding over as I was not thinking shouldBe would be the problem.
So is shouldBe not the right thing to use for comparing 2 lists?Be aware thatis different fromInstancePerTest
, which I find the most intuitive and consistent with plain JUnit.InstancePerLeaf
@wasyl thanks this is a very good point, I think I want to use InstancePerLeaf actually here 🙂 I will try this next
wasyl
10/22/2020, 3:55 PMhuehnerlady
10/22/2020, 3:57 PMio.kotest:kotest-assertions-core-jvm
io.kotest:kotest-extensions-spring
io.kotest:kotest-framework-engine-jvm
io.kotest:kotest-property-jvm
io.kotest:kotest-runner-junit5-jvm
wasyl
10/22/2020, 3:59 PMorg.junit:junit-bom:5.7.0
huehnerlady
10/22/2020, 4:00 PMwasyl
10/22/2020, 4:01 PMhuehnerlady
10/22/2020, 4:03 PMsam
10/22/2020, 4:07 PMhuehnerlady
10/22/2020, 4:08 PM