Mastering Behavior-Driven Development Using Cucumber: Practice and Implement Page Object Design Pattern, Test Suites in Cucumber, POM TestNG Integration, Cucumber Reports, and work with Selenium Grid
()
About this ebook
The book is divided into three sections. The first section covers the building blocks of Cucumber such as Feature files, Step Definition classes, and Runner classes, among other things. These will serve as the building blocks for becoming more familiar with Cucumber.
The second section covers the Page Object design pattern and Page Factories, both of which are useful in developing robust frameworks.
The final section demonstrates Cucumber's integration with TestNG and Maven. We will be putting each Maven build in Jenkins and configuring Jenkins to trigger automatically when a development build is completed.
After reading this book, the test engineer will understand the concept of incorporating Cucumber as a BDD framework into his testing. As a result, he will be able to streamline the testing and bug detection processes.
Related to Mastering Behavior-Driven Development Using Cucumber
Related ebooks
Selenium Framework Design in Keyword-Driven Testing: Automate Your Test Using Selenium and Appium Rating: 0 out of 5 stars0 ratingsAppium Essentials Rating: 0 out of 5 stars0 ratingsPerformance Testing with JMeter - Second Edition Rating: 0 out of 5 stars0 ratingsSelenium with Java – A Beginner’s Guide: Web Browser Automation for Testing using Selenium with Java Rating: 0 out of 5 stars0 ratingsMockito Essentials Rating: 3 out of 5 stars3/5Mastering Mobile Test Automation Rating: 0 out of 5 stars0 ratingsSelenium Design Patterns and Best Practices Rating: 5 out of 5 stars5/5Selenium Essentials Rating: 3 out of 5 stars3/5Science of Selenium Rating: 0 out of 5 stars0 ratingsCucumber Cookbook Rating: 0 out of 5 stars0 ratingsTest-Driven Java Development Rating: 4 out of 5 stars4/5Testing with JUnit Rating: 0 out of 5 stars0 ratingsPerformance Testing with JMeter 2.9 Rating: 0 out of 5 stars0 ratingsMastering Unit Testing Using Mockito and JUnit Rating: 0 out of 5 stars0 ratingsSelenium with Python - A Beginner’s Guide: Get started with Selenium using Python as a programming language Rating: 0 out of 5 stars0 ratingsSelenium Interview Questions & Answers Rating: 5 out of 5 stars5/5Testing Web APIs Rating: 0 out of 5 stars0 ratingsMobile Test Automation with Appium Rating: 0 out of 5 stars0 ratingsJasmine JavaScript Testing - Second Edition Rating: 0 out of 5 stars0 ratingsRobot Framework Test Automation Rating: 4 out of 5 stars4/5Extending Jenkins Rating: 0 out of 5 stars0 ratingsThe Agile Software Tester: Software Testing in the Agile World Rating: 0 out of 5 stars0 ratingsBuilding a RESTful Web Service with Spring Rating: 5 out of 5 stars5/5Spring Boot 2: How To Get Started and Build a Microservice - Third Edition Rating: 5 out of 5 stars5/5JMeter Cookbook Rating: 0 out of 5 stars0 ratingsInstant Approach to Software Testing Rating: 0 out of 5 stars0 ratings
Internet & Web For You
Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Coding For Dummies Rating: 5 out of 5 stars5/5More Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5Introduction to Internet Scams and Fraud: Credit Card Theft, Work-At-Home Scams and Lottery Scams Rating: 4 out of 5 stars4/5Hacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 5 out of 5 stars5/5The Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5SEO For Dummies Rating: 4 out of 5 stars4/5Cybersecurity For Dummies Rating: 4 out of 5 stars4/5Beginner's Guide To Starting An Etsy Print-On-Demand Shop Rating: 0 out of 5 stars0 ratingsTor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5How To Make Money Blogging: How I Replaced My Day-Job With My Blog and How You Can Start A Blog Today Rating: 4 out of 5 stars4/5Wireless Hacking 101 Rating: 4 out of 5 stars4/5The Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5200+ Ways to Protect Your Privacy: Simple Ways to Prevent Hacks and Protect Your Privacy--On and Offline Rating: 0 out of 5 stars0 ratingsThe Cyber Attack Survival Manual: Tools for Surviving Everything from Identity Theft to the Digital Apocalypse Rating: 0 out of 5 stars0 ratingsSix Figure Blogging Blueprint Rating: 5 out of 5 stars5/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5How To Start A Podcast Rating: 4 out of 5 stars4/5The Internet Is Not What You Think It Is: A History, a Philosophy, a Warning Rating: 4 out of 5 stars4/5Podcasting For Dummies Rating: 4 out of 5 stars4/5How to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5
Reviews for Mastering Behavior-Driven Development Using Cucumber
0 ratings0 reviews
Book preview
Mastering Behavior-Driven Development Using Cucumber - Pinakin A Chaubal
CHAPTER 1
Introduction to Behavior Driven Development
Welcome to the exciting world of Behavior Driven Development ( BDD ). This book will be divided into three parts. The first part will make the user understand what Cucumber is all about. The second part will explore the Page Object Model and Page Factories. The third part will cover integration of Cucumber with the TestNG framework. It is going to be a very exciting journey, so let’s get started and understand what BDD is all about.
BDD helps to bridge the gap between business people and technical people by implementing a language called ‘Gherkin’. It consists of statements in English predominantly, although other languages are available for this purpose too. A group of Gherkin statements together lists a functional flow. These statements are taken by the Automation developer and converted into code using frameworks like Cucumber, JBehave or Specflow. BDD is quite frequently used in Agile projects for getting quick feedback on code quality after developers check in their code in source code management systems like GitHub or SVN. The BDD tests can be configured to execute immediately after the code is checked in.
This chapter will predominantly focus on
Test Driven Development
Behavior Driven Development
Understanding Gherkin
Introduction to Cucumber
Understanding the DRY principle
Components of Cucumber
Setup of the project in Eclipse
Setup of TestNG in Eclipse
Understanding the project structure
Objective
After reading this chapter, the reader will be conversant with the concepts of TDD, BDD, Gherkin and able to create a basic file called ‘Feature File’ in the Gherkin Language. He will also learn how the Gherkin file relates to the Step Definition file which is one of the components of Cucumber. He will get knowledge of the project structure and understand how to set up a project in Eclipse along with TestNG Plugin integration. This chapter will serve as the foundation for one who wishes to work as a Test Automation Engineer and wants to make a career in BDD framework.
1.1 What is TDD?
TDD stands for Test Driven Development. Test Driven Development is a software development process where test cases are written first taking into consideration the requirements in a traditional project or the user stories in a scrum or agile project. Once the tests are created, minimal code to make the tests pass is created. As and when new tests are created, the code is updated to make the new tests pass and at the same time ensuring that the existing tests pass as well.
TDD (We will refer to this acronym for Test Driven Development going forward) was developed or rediscovered by Kent Beck in 2003 to facilitate simple designs. TDD is related to test first programming concepts of Extreme Programming.
1.1.1 Steps involved in a TDD
The steps mentioned below should be followed in a typical Test Driven Development approach.
Write the test: This activity can be done by the tester or developer where a test is created from the user story, requirement or use case. This is contrasted to the traditional approach of writing unit tests after the code is written. TDD enables the developer to focus on the requirements (We will refer to user stories, traditional requirements or use cases as requirements going forward) before getting started with the code. This differentiated TDD from a traditional development approach.
Run the test to check that it fails: Prepare the development system such that bare minimum code is there to make your application run like creating the main method or a screen with the required stubs for the database or web service for example. Since writing the test was the very first activity done, it should definitely fail since we don't have any code in place to support the test. If the test fails, then we are sure that the test has been written correctly.
Write the development code: Now it's time to make our test pass by writing only the required code to make the test pass. It is strongly recommended not to write more code in this step. Writing more code results in what is called Gold Plating where you are just giving additional features that are not required at the present moment.
Check to see that the test passes: Run our first test again and this time it should pass. This helps to ensure that all the correct development code is in place and we can move on to the next test.
Refactor the code: In the iterative TDD process, we need to make sure that we have not introduced any duplication, all the design principles are met and the methods are where they are supposed to be, that is, logically grouped together in a