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
  public void VerifyThatUserCanLoginToFaceebookAndReactUsingHeart() {

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.

2 Answers 2


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 
  • is there any other way? or this is the recommended practice. Here the description is not coming in emailable report
    – PDHide
    Jun 29, 2019 at 16:22
  • 2
    You will have to customize the report to include description
    – Moro
    Jun 29, 2019 at 16:25

Every software testing company has its own practice to follow in automation frameworks.

The way mentioned in your query is also correct but to avoid long method names user can pick the important keywords from the test case which can easily tell the purpose of the method without reading the internal code written inside the method.

For example:

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

Moreover, proper naming convention should be followed like words should be in camel case notation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.