
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
Set Order of Execution for Test Methods in Cucumber
We can set the order of execution for test methods in Cucumber with the help of order keyword. Test methods are assigned with order in the step definition file.
The test method with lower order executes first followed by the methods with higher orders.
Example
Step definition file.
@Before (order = 1) public void login(){ System.out.println("login is successful"); } @Before (order = 2) public void payment(){ System.out.println("payment is successful"); } @Given ("^Land in repayment page$") public void repay(){ System.out.println ("Actual Scenario of repayment"); }
The test method with lower order (login() set to 1) will be executed first. Then payment () test method will be executed with a higher order.
Once these methods get executed successfully test method repay() will be executed.
Advertisements