How to run multiple test cases using TestNG Test Suite in Selenium?

0 votes
May 21 in Selenium by Neerja
176 views

1 answer to this question.

0 votes

Hi Neerja, to run multiple test cases using TestNG test suite in selenium, perform these steps one by one:

  1. Right click on Project folder, go to New and select ‘File‘.

  2. In New file wizard, add file name as ‘testng.xml‘ and click on Finish button.

  3. It will add testng.xml file under your project folder. 

  4. Now add below given code in your testng.xml file. After giving appropriate names and adding your test cases in <classes> tag, your testng.xml file will looks like this:

    • <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
      
      <suite name="Test Suite-1" >
      
      <test name="Test Case-1" >
      
      <classes>
      
      <class name="co.edureka.selenium.demo1.Demo1" />
      
      <class name="co.edureka.selenium.demo1.Demo2" />
      
      <class name="co.edureka.selenium.demo1.ImgExistTest" />
      
      <class name="co.edureka.selenium.demo1.ForgotPassword" />
      
      </classes> 
      
      </test>
      
      </suite>
  5. Now run the xml file by right click on the testng.xml file and select Run As > TestNG Suite.

answered May 21 by Abha
• 20,110 points

Related Questions In Selenium

0 votes
1 answer

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

Download the executable driver from: ChromeDriver Download Before ...READ MORE

answered Mar 29, 2018 in Selenium by nsv999
• 5,070 points
208 views
0 votes
1 answer
0 votes
1 answer

How to run test scripts in Selenium using PhantomJS?

Hey @Shushil, you can run your test ...READ MORE

answered May 17 in Selenium by Abha
• 20,110 points
37 views
0 votes
1 answer

How to run test cases in headless mode using Phantom JS?

Hi Bhanu, you can run test cases ...READ MORE

answered Aug 14 in Selenium by Abha
• 20,110 points
10 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,070 points
443 views
0 votes
1 answer
0 votes
1 answer

What is the role of TestNG & JUnit frameworks in Selenium?

Well TestNG and JUnit are test frameworks ...READ MORE

answered Apr 18, 2018 in Selenium by king_kenny
• 3,610 points
224 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
791 views
0 votes
1 answer

How to run a group of test cases using TestNG in Selenium Webdriver?

Hey Kajal, TestNG allows you to perform ordered ...READ MORE

answered Jun 12 in Selenium by Abha
• 20,110 points
66 views
0 votes
1 answer