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 with Java – A Beginner’s Guide: Web Browser Automation for Testing using Selenium with Java Rating: 0 out of 5 stars0 ratingsTesting with JUnit Rating: 0 out of 5 stars0 ratingsTest-Driven Java Development Rating: 0 out of 5 stars0 ratingsSelenium Framework Design in Keyword-Driven Testing: Automate Your Test Using Selenium and Appium Rating: 0 out of 5 stars0 ratingsAbsolute Beginner (Part 1) Selenium WebDriver for Functional Automation Testing Rating: 5 out of 5 stars5/5Learning Selenium Testing Tools - Third Edition Rating: 0 out of 5 stars0 ratingsEffective Test Case Writing Rating: 4 out of 5 stars4/5Learn Selenium in 24 Hours Rating: 0 out of 5 stars0 ratingsSelenium Testing Tools Cookbook Rating: 3 out of 5 stars3/5The Agile Software Tester: Software Testing in the Agile World Rating: 0 out of 5 stars0 ratingsLearn Java 12 Programming: A step-by-step guide to learning essential concepts in Java SE 10, 11, and 12 Rating: 0 out of 5 stars0 ratingsGetting Started With TestNG (A Java Test Framework) Rating: 0 out of 5 stars0 ratingsSelenium Design Patterns and Best Practices Rating: 5 out of 5 stars5/5Selenium with C#: Learn how to write effective test scripts for web applications using Selenium with C# (English Edition) Rating: 0 out of 5 stars0 ratingsInstant Approach to Software Testing Rating: 0 out of 5 stars0 ratingsMastering Unit Testing Using Mockito and JUnit Rating: 0 out of 5 stars0 ratingsParallel Programming with C# and .NET Core: Developing Multithreaded Applications Using C# and .NET Core 3.1 from Scratch 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 ratingsAgile Testing: An Overview Rating: 4 out of 5 stars4/5Writing High-Performance .NET Code, 2nd Edition Rating: 5 out of 5 stars5/5Java 9 Concurrency Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsJava 8 to 21: Explore and work with the cutting-edge features of Java 21 (English Edition) Rating: 0 out of 5 stars0 ratings.NET Design Patterns Rating: 3 out of 5 stars3/5Core Java Professional: For First Time Learner's. Rating: 0 out of 5 stars0 ratingsMockito for Spring Rating: 0 out of 5 stars0 ratingsMockito Essentials Rating: 3 out of 5 stars3/5Performance Testing with JMeter - Second Edition Rating: 0 out of 5 stars0 ratingsWhat is Software Testing?: ISTQB Foundation Companion and Study Guide Rating: 5 out of 5 stars5/5Java Core Interview in Australia. Questions and Answers. Tech interviewer’s notes Rating: 0 out of 5 stars0 ratings
Internet & Web For You
The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours 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/5Notion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5Cybersecurity For Dummies Rating: 5 out of 5 stars5/5Coding For Dummies Rating: 5 out of 5 stars5/5Coding All-in-One 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/5UX/UI Design Playbook Rating: 4 out of 5 stars4/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Get Into UX: A foolproof guide to getting your first user experience job Rating: 4 out of 5 stars4/548 Really Useful Web Sites 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/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5Principles of Web Design Rating: 0 out of 5 stars0 ratingsHow to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsSocial Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5The Basics of User Experience Design by Interaction Design Foundation Rating: 4 out of 5 stars4/5Canva Tips and Tricks Beyond The Limits Rating: 3 out of 5 stars3/5Build a WordPress Website From Scratch 2024: WordPress 2024 Rating: 0 out of 5 stars0 ratingsThe Designer’s Guide to Figma: Master Prototyping, Collaboration, Handoff, and Workflow Rating: 3 out of 5 stars3/5Ultimate guide for being anonymous: Avoiding prison time for fun and profit Rating: 5 out of 5 stars5/5The Gothic Novel Collection Rating: 5 out of 5 stars5/52022 Adobe® Premiere Pro Guide For Filmmakers and YouTubers Rating: 5 out of 5 stars5/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