Cucumber Cookbook
By Shankar Garg
()
About this ebook
- Create a test automation framework to handle web, REST, and native mobile application automation
- Discover Glue code, Hooks, Tags, and Cucumber’s integration with Maven, Jenkins, and Git
- Comprehensive recipes in Cucumber for behaviour-driven development and test automation
This book is intended for business and development personnel who want to use Cucumber for behavior-driven development and test automation. Readers with some familiarity with Cucumber will find this book of most benefit.
Since the main objective of this book is to create test automation frameworks, previous experience in automation will be helpful.
Related to Cucumber Cookbook
Related ebooks
Selenium Essentials Rating: 3 out of 5 stars3/5Mockito Essentials Rating: 3 out of 5 stars3/5Robot Framework Test Automation Rating: 4 out of 5 stars4/5Appium Essentials Rating: 0 out of 5 stars0 ratingsJMeter Cookbook Rating: 0 out of 5 stars0 ratingsBuilding a RESTful Web Service with Spring Rating: 5 out of 5 stars5/5Jasmine JavaScript Testing - Second Edition Rating: 0 out of 5 stars0 ratingsBootstrap for ASP.NET MVC - Second Edition Rating: 5 out of 5 stars5/5Mastering Java EE Development with WildFly Rating: 0 out of 5 stars0 ratingsPractical DevOps Rating: 3 out of 5 stars3/5Application Development with Swift Rating: 0 out of 5 stars0 ratingsLearning Behavior-driven Development with JavaScript Rating: 5 out of 5 stars5/5Flask Framework Cookbook Rating: 5 out of 5 stars5/5Mastering Mobile Test Automation Rating: 0 out of 5 stars0 ratingsPerformance Testing with JMeter 2.9 Rating: 0 out of 5 stars0 ratingsPerformance Testing with JMeter - Second Edition Rating: 0 out of 5 stars0 ratingsLearning Selenium Testing Tools - Third Edition Rating: 0 out of 5 stars0 ratingsSelenium Testing Tools Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsSelenium Testing Tools Cookbook Rating: 3 out of 5 stars3/5JUnit Recipes: Practical Methods for Programmer Testing Rating: 4 out of 5 stars4/5Web Services Testing with soapUI Rating: 5 out of 5 stars5/5Mobile Testing: An ASTQB-BCS Foundation guide Rating: 0 out of 5 stars0 ratingsApi Testing A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsTest-Driven Java Development Rating: 4 out of 5 stars4/5Mobile Test Automation with Appium Rating: 0 out of 5 stars0 ratingsSelenium Testing Tools Interview Questions You'll Most Likely Be Asked: Second Edition Rating: 0 out of 5 stars0 ratingsSelenium Design Patterns and Best Practices Rating: 5 out of 5 stars5/5(Part 2) Java 4 Selenium WebDriver: Come Learn How To Program For Automation Testing Rating: 0 out of 5 stars0 ratings
Programming For You
HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming Rating: 0 out of 5 stars0 ratingsLearn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsJava for Beginners: A Crash Course to Learn Java Programming in 1 Week Rating: 5 out of 5 stars5/5The Unofficial Guide to Open Broadcaster Software: OBS: The World's Most Popular Free Live-Streaming Application Rating: 0 out of 5 stars0 ratingsPYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5The Little SAS Book: A Primer, Sixth Edition Rating: 5 out of 5 stars5/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Teach Yourself C++ Rating: 4 out of 5 stars4/5Pokemon Go: Guide + 20 Tips and Tricks You Must Read Hints, Tricks, Tips, Secrets, Android, iOS Rating: 5 out of 5 stars5/5
Reviews for Cucumber Cookbook
0 ratings0 reviews
Book preview
Cucumber Cookbook - Shankar Garg
Table of Contents
Cucumber Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Writing Feature Files
Introduction
Writing your first Feature file with one Scenario
How to do it…
How it works…
Feature
Scenarios
Steps
Creating Scenarios with different Steps
How to do it…
How it works…
Creating a Scenario with the And and But keywords
Getting ready…
How to do it…
How it works…
Writing a Feature file with multiple Scenarios
How to do it…
How it works…
Adding Backgrounds to Feature files
Getting ready
How to do it…
How it works…
Sending multiple arguments in Steps
How to do it…
How it works…
Using complex data types to store data
Getting ready
How to do it…
How it works…
Implementing Scenario Outlines
Getting ready
How to do it…
How it works…
Creating a Feature file in a language other than English
How to do it…
How it works…
Combining Scenarios, Backgrounds, and Scenario Outlines
How to do it…
How it works…
2. Creating Step Definitions
Introduction
Creating your first Step Definitions file
How to do it…
How it works…
Step Definitions
Undefined Steps
Pending Steps
Implemented Steps
Identifying Duplicate and Ambiguous Step Definitions
How to do it…
How it works…
Using Regular Expressions to optimize Step Definitions
How to do it…
How it works…
Using Optional Capture and Noncapture Groups
How to do it…
How it works…
Transforming Data Tables to parse the test data
How to do it…
How it works…
Implementing data table diffs to compare tables
How to do it…
How it works…
Using Doc Strings to parse big data as one chunk
How to do it…
How it works…
Combining Doc Strings and Scenario Outlines
How to do it…
How it works…
Defining String transformations for better conversions
Getting ready
How to do it…
How it works…
3. Enabling Fixtures
Introduction
Tagging
Getting ready
How to do it…
How it works…
ANDing and ORing Tags
Getting ready
How to do it…
How it works…
Adding Hooks to Cucumber code
Getting ready
How to do it…
How it works…
There's more…
Tagging the Hooks
Getting ready
How to do it…
How it works…
ANDing and ORing tagged Hooks
Getting ready
How to Do it
How it works…
4. Configuring Cucumber
Introduction
Integrating Cucumber with JUnit
How to do it…
How it works…
Overriding the Cucumber Options
How to do it…
How it works…
Running Strict and Running Dry
How to do it…
How it works…
Configuring the Cucumber Console output
How to do it…
How it works…
Directing the Cucumber output to a file
How to do it…
How it works…
Configuring the naming conventions
How to do it…
How it works…
5. Running Cucumber
Introduction
Integrating Cucumber with Maven
Getting ready
How to do it…
How it works…
Running Cucumber from the Terminal
How to do it…
How it works…
Overriding Options from the Terminal
How to do it…
How it works…
Integrating Cucumber with Jenkins and GitHub
Getting ready
How to do it…
How it works…
Running Cucumber test cases in parallel
How to do it…
How it works…
6. Building Cucumber Frameworks
Introduction
Building a Web Automation framework
Getting ready
How to do it…
How it works…
Building a Mobile Automation framework
Getting ready
How to do it…
How it works…
Building a REST Automation framework
How to do it…
How it works…
Index
Cucumber Cookbook
Cucumber Cookbook
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2015
Production reference: 1260515
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-600-1
www.packtpub.com
Credits
Author
Shankar Garg
Reviewers
John Kamenik
Nguyen Quang Phuong
Abhishek Yadav
Commissioning Editor
Priya Singh
Acquisition Editor
Larissa Pinto
Content Development Editor
Sriram Neelakantan
Technical Editors
Namrata Patil
Bharat Patil
Copy Editors
Puja Lalwani
Laxmi Subramanian
Project Coordinator
Vijay Kushlani
Proofreaders
Stephen Copestake
Safis Editing
Indexer
Rekha Nair
Graphics
Jason Monteiro
Production Coordinator
Melwyn D'sa
Cover Work
Melwyn D'sa
About the Author
Shankar Garg is an Agile enthusiast with expertise in automation testing. Currently, he is working as a senior consultant, testing with Xebia IT Architects, India.
He started as a Java developer but his love for breaking things got him into testing. He has worked on the automation of many projects for web, mobile, and SOA technologies. Right now, he is in love with Cucumber, Selenium, Appium, and Groovy.
Prior to working with Xebia, he worked for Jabong.com, Honeywell, and Tata Consultancy Services (TCS).
He is a Certified Scrum Master (CSM), Certified Tester (ISTQB), Certified Programmer for Java (SCJP 5.0) and Oracle 9i (OCA).
I would like to thank my family, especially my wife and daughter, for putting up with my late night / early morning writing sessions. Without your support, this book would not have been possible. Thanks for your patience and understanding.
I would also like to thank Xebia IT Architects, India, because if it were not for the inspiration that I got in Xebia IT Architects, India, I would have never thought of writing a book, let alone finishing it on time. All credit goes to the Xebia DNA. Thank you, Xebia!!
About the Reviewers
Nguyen Quang Phuong works at a small start-up company, Mobilus (http://mobilus.co.jp). Mobilus provides a real-time communication platform and an SDK called Konnect. All members are working hard to create more innovative products.
As a full-stack engineer, he works from the frontend to the backend. In the frontend, he has experiences working with iOS applications and responsive, real-time web services for mobile browser and PC browsers. He also works on advanced frameworks such as Meteor to create an application that runs everywhere (browser, iOS, and Android-native applications) with JavaScript or HTML5. In the backend, he designs APIs and data models and does server tasks, such as hosting environments.
He is also a member of the Meteor community and takes part in a project to translate Discover Meteor into Vietnamese (http://vi.discovermeteor.com/). In this project, he learned how to make real-time applications with JavaScript.
I want to thank my colleague Takeharu Oshida, who teaches me a lot about new technologies and who introduced this book to me.
Abhishek Yadav is an experienced consultant having expertise in automation testing, including automation framework development. Currently, he is working with Xebia IT Architects India Pvt. Ltd., Gurgaon.
He has primarily worked on Selenium WebDriver and Java. Apart from this, he also has expertise in Cucumber, JMeter, AutoIt, Maven, TestNG, and Appium. Other than testing, he has a good exposure of technologies such as HTML, CSS, JQuery, JavaScript, and SQL.
He shares his automation experience through his blog Hello Selenium (http://www.helloselenium.com). These experiences have helped him a lot in reviewing this book. He has also taken help from his colleagues, wherever required, to make this book more informative to the readers.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT