- 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 to set the 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.
- Related Articles
- How to skip a particular test method from execution in Cucumber?
- How to run precondition and postcondition test methods in Cucumber?
- What is the order of execution of TestNG methods?
- 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 test runner prioritize test classes for execution in Selenium?
- How to create a test runner file for Cucumber in Java?
- How to run tests using a test runner file for Cucumber?
- How to include and exclude test methods from a set of test cases in\nCucumber?
- How to set delay for MySQL trigger/procedure execution?
- How to exclude a test from execution in Pytest?
- Java Program to Calculate the Execution Time of Methods
- Haskell Program to Calculate the Execution Time of Methods
- How to skip a selected test from execution in pytest?
- How to trigger headless test execution in Selenium with Python?

Advertisements