Quick testing tips #2


Declare test methods in different styles in Junit5




import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test

class Test{
  @Test
  fun itShouldPass(){}

  @Test
  fun it_should_pass(){}

  @Test
  fun `it should pass`(){}

  @Test
  @DisplayName("it should pass")
  fun test(){}
}



Use test method signature that works best for you and your team. To have test names more readable, consider putting test method name in `backticks`, or use @DisplayName annotation



Read next:


Loading ...
Failed to load data.