Hello~! I’m trying to use SpringExtension With Iso...
# kotest
h
Hello~! I’m trying to use SpringExtension With IsolationMode.InstancePer(Test | Leaf), But it is not working… ex) in kotest-extensions-spring test if I change this code to
Copy code
...
@ContextConfiguration(classes = [(Components::class)])
class SpringExtensionTest : WordSpec() {
   override fun isolationMode() = IsolationMode.InstancePerTest // or InstancePerLeaf
   override fun extensions() = listOf(SpringExtension)

   @Autowired
   private var service: UserService? = null

   init {
      "SpringExtension" should {
         "have autowired the service" {
            service?.repository?.findUser()?.name shouldBe "system_user"
         }
...
‘have autowired the service’ test is broken --- but I change this code to
Copy code
...
@ContextConfiguration(classes = [(Components::class)])
class SpringListenerTest : WordSpec() {
   override fun isolationMode() = IsolationMode.InstancePerTest // or InstancePerLeaf
   override fun listeners() = listOf(SpringListener)

   @Autowired
   private var service: UserService? = null

   init {
      "SpringListener" should {
         "have autowired the service" {
            service?.repository?.findUser()?.name shouldBe "system_user"
         }
...
It works
s
Might be a bug with extensions vs listeners
h
Thank you for your answer 🙂 Is it known issue?, or Do I need to open issue?
s
If you would open an issue that would be great
🙂 1
h