![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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.
Advertisements