How to write meaningful test case title in TestNG+Selenium



  • When writing manual test cases, the test case title used to be something like

    TC1: Verify that the user is able to login to facebook and react using heart.

    When trying to automate the scenario using selenium+ TestNG, how to write meaningful test case titles.

    Note: I believe that in TestNG, the test case name is the same as the method identifier under @test annotation

    //Testcase 1
      @Test
      public void VerifyThatUserCanLoginToFaceebookAndReactUsingHeart() {
       //Writeyourcodehere
    }
    

    Is it permissible to write such long method names or is there a better way to write test case names in TestNG or/and selenium.



  • I would keep the method name simple and add description in the @Test annotation like this:

    @Test(description = "User can log into facebook and react with heart")
    public void loginReactHeart() {
        //some code 
    }
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2