
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Combine Multiple Groups into a Single Test in TestNG
We can combine multiple groups to single Test in TestNG with the help of test group feature.
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 = "QuestionAnswer"/> </run> <run> <include name = "Jobs"/> </run> </groups> <classes> <class name = "TestParam" /> </classes> </test> </suite>
To run a group of test cases from the collection of test cases, we have to define <groups> in the testng xml file. Here the testNG xml contains multiple groups QuestionAnswer and Jobs to be associated to a single Test.
Example
@Test(groups={"QuestionAnswer"},{"Jobs"}) public void preparation(){ System.out.println("Preparation module is verified"); }
In the Java class file the test methods with group as QuestionAnswer and Jobs are associated with the test method preparation().
Advertisements