divinenickname / utgen-kotlin-idea-plugin

Simplify your testing process with automated test generation tailored for Kotlin codebases.
https://plugins.jetbrains.com/plugin/23907-utgen
Apache License 2.0
3 stars 1 forks source link

Test object should be in test method #2

Closed ENRyzhkova closed 3 months ago

ENRyzhkova commented 3 months ago

Hello! I have small issue in your implementation of test suites.

Generated code:

package org.pkg

import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test

internal class MyAwesomeTest {
  private val obj: MyAwesome = MyAwesome()

  @Test
  public fun yoyo_goldencase() {
    TODO("Implement")
    val expected = Int()
    val actual = obj.yoyo()

    Assertions.assertEquals(expected, actual)
  }
}

private val obj: MyAwesome = MyAwesome() - this instantiation should be in each tests method because some methods may mutate object's state. Junit execute tests in random order by default.

Version 1.1.0

divinenickname commented 3 months ago

Should be fixed in 1.2.0 - 1.2.1 (not released in marketplace yet)

divinenickname commented 3 months ago

fixed in 1.2.2