- 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 does the execution of a particular test method depend on other test
methods in TestNG?
The execution of a particular test method can be made dependent on another test method with the help of dependsOnMethods helper attribute.
Example
@Test(dependsOnMethods={"Payment"}) public void verifyLoan(){ System.out.println("Loan payment successful"); } @Test public void Payment(){ System.out.println("Payment successful "); } @Test public verifyTransaction(){ System.out.println ("Transaction verification"); }
Here in the Java class file, verifyLoan() method will only be executed after the Payment() method is run successfully. But verifyTransaction() method runs independently without having a precondition test method to be executed.
- Related Articles
- How does running a specific test method depend on another test method in TestNG?
- How to overlook a particular test method from execution in TestNG?
- How to skip a particular test method in TestNG?
- How to skip a particular test method from execution in Cucumber?
- How to retrieve test method description in TestNG before and after execution?
- How to retrieve test method name in TestNG before and after execution?
- How does TestNG invoke a test method using multiple threads?
- How to incorporate and remove test methods from execution from a\ncollection of test cases in TestNG?
- What is the order of test execution with priority in TestNG?
- How can a particular group of test cases get executed in TestNG?
- How to get the test group name in TestNG before and after execution?
- How to disable a TestNG test based on a condition?
- How to get the name of a test method that was run in a TestNG teardown method?
- How test runner prioritize test classes for execution in Selenium?
- How to run test groups in TestNG?

Advertisements