How to do TestNG test suite with Hello World test case – step by step explanation given below.

Prerequisite: Eclipse + Maven + Selenium + TestNG Setup
If you already have necessary software setup, jump to step 1. Else refer this link for details about software setup;
https://digitalappconsultancy.com/site/eclipse-selenium-java-testng-project-setup/

Software used are listed below;

Eclipse 4.6.x
JDK 1.8.x
Selenium Java WebDriver 3.4.0
Chrome Driver 2.29
TestNG 6.10

Finally the project should look as below;

Step 1: Create TestNG Suite xml

Create new file TestNGRegressionSuite.xml under src/main/resources folder.

TestNGRegressionSuite.xml provided below

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
 
<suite name="RegressionSuite" verbose="1" >
  <test name="RegressionTestCases"   >
    <packages>
      <package name="com.regression" />
   </packages>
 </test>
</suite>

Step 2: Create TestNG HelloWorldTest

Create new TestNG test class and name it as HelloWorldTest.java.

package com.regression;

import static org.testng.Assert.assertEquals;

import org.testng.annotations.Test;

public class HelloWorldTest {
    
  @Test
  public void testHelloWorld() {
      assertEquals(true, true);
  }
}

Step 3: Execute TestNG suite xml

Now you can right click on suite xml (TestNGRegressionSuite.xml) and run as – TestNG Suite.

Refer YouTube tutorial with detailed explanation

Finally the project should look as below;

For further reading refer Java Selenium Programming Category posts.

Share this post

How to do TestNG test suite with Hello World test case
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *