
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How to execute a particular test method multiple times (say 5 times) in TestNG?
We can execute a particular test method multiple times (say 5 times) with the help of the invocationCount helper attribute.
Example
@Test public void PaymentDetails(){ System.out.println("Payment details validation is successful”); } @Test(invocationCount=5) public void LoginAdmin(){ System.out.println("Login in admin is successful”); } @Test public void LeaseDetails(){ System.out.println("Lease details verification is successful”); }
In the Java class file, the LoginAdmin() method with invocationCount set to 5 will result in Login in admin is a successful message to be printed five times on the console.
- Related Questions & Answers
- How to skip a particular test method in TestNG?
- How to overlook a particular test method from execution in TestNG?
- How does TestNG invoke a test method using multiple threads?
- How to run multiple test classes in TestNG?
- How does the execution of a particular test method depend on other test methods in TestNG?
- How to run multiple test cases using TestNG Test Suite in Selenium?
- How to combine multiple groups to single Test in TestNG?
- Push and slice multiple times in MongoDB?
- How can a particular group of test cases get executed in TestNG?
- Add similar value multiple times in a Python list
- How does running a specific test method depend on another test method in TestNG?
- How to print a name multiple times without loop statement using C language?
- Count number of times value appears in particular column in MySQL?
- How to skip a particular test method from execution in Cucumber?
- Python Program to Search the Number of Times a Particular Number Occurs in a List
Advertisements