- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can a particular group of test cases get executed in TestNG?
We can run a particular set of test cases by including a group of test cases in the execution.
Example
Testng xml files with groups.
<?xml version = "1.0" encoding = "UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name = "Tutorialspoint Test"> <test name = "Regression Cycle 1"> <groups> <run> <include name = "Smoke"/> </run> </groups> <classes> <class name = "TestParam" /> </classes> </test> </suite>
To run a group of test cases from the set of test cases, we have to define <groups > in the testng xml file. Here the testNG xml contains group Smoke to be included in execution.
Example
@Test(groups={"Smoke"}) public void Payment(){ System.out.println(“Payment is successful”); }
In the Java class file only the test method with group as Smoke will be run out of the entire regression suite.
- Related Articles
- How to skip a particular test method in TestNG?
- How to run multiple test cases using TestNG Test Suite in Selenium?
- How to get the test group name in TestNG before and after execution?
- How to set priority to the test cases in TestNG?
- How to group test cases in Pytest?
- How to overlook a particular test method from execution in TestNG?
- How to incorporate and remove test methods from execution from a\ncollection of test cases in TestNG?
- How does the execution of a particular test method depend on other test\nmethods in TestNG?
- How to get a list of all the test methods in a TestNG class?
- How to get the name of a test method that was run in a TestNG teardown method?
- How to obtain the time taken for a method to be executed in TestNG?
- How to run test groups in TestNG?
- How to run multiple test classes in TestNG?
- How to Write Test Cases?
- How does running a specific test method depend on another test method in TestNG?

Advertisements