- 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 do you use regular expressions in Cucumber?
We can use regular expressions in Cucumber for selecting a collection of similar statements in the feature file.
Example
feature file
Feature: Exam Syllabus Scenario Outline: Summer and Winter Exam Schedule Given Exam time table in summer season Given Mathematics and Physics Syllabus Given Exam time table in winter season
The step Definition file has @Given("^Exam time table in ([^\"]*) season$") which maps two Given statements in a Feature file with the help of regular expression.
Example
@Given ("^Exam time table in ([^\"]*) season$") public void timeTable(String season){ if (season.equals("winter")){ System.out.println("The winter syllabus"); }else{ System.out.println("The summer syllabus"); } } @Given ("^Mathematics and Physics Syllabus$") public void syllabusList(){ System.out.println("Mathematics and Physics syllabus is"); }
- Related Articles
- How do we use wildcard or regular expressions with a jQuery selector?
- How do backslashes work in Python Regular Expressions?
- How to use regular expressions with TestNG?
- How to use regular expressions in a CSS locator?
- What do you mean by glue in Cucumber?
- Use the ? quantifier in Java Regular Expressions
- What do you mean by Scenario Outline in Cucumber?
- Use a character class in Java Regular Expressions
- How to use regular expressions in css in Selenium with python?
- How to use regular expressions in xpath in Selenium with python?
- How you can get a true/false from a Python regular expressions?
- How to use regular expressions (Regex) to filter valid emails in a Pandas series?
- How do we use re.finditer() method in Python regular expression?
- JavaScript Regular Expressions
- How do we use Python Regular Expression named groups?

Advertisements