
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Compare Playwright and Cucumber BDD to learn how Java-based automation combines reliable end-to-end automated tests with a non-technical requirements layer.
Discover why learning Playwright and Cucumber BDD is valuable, guided by current trends, and learn to set up Playwright with Java and Maven for automated tests.
Explore the open-source Playwright code and the public Java repository to dive into the code, review open issues and pull requests, and recognize Microsoft maintains Playwright.
Explore the Playwright community resources, including the ambassador page, GitHub, StackOverflow questions, and the Discord community, to collaborate and solve issues.
Configure the Java development kit (JDK) on your machine, download version 21 for Windows, mac, or Linux, set JAVA_HOME and PATH, and verify with java -version for Jenkins compatibility.
Install Apache Maven by downloading the latest version, extracting it, setting m2_home and path, and using mvn -v to manage dependencies like Playwright in your Java projects.
Install git bash as an extra terminal on Windows, Mac, or Linux; download and install, then verify Java and mvn versions.
Install the IntelliJ IDE community edition from the free version, download the Windows 64-bit installer, and complete the installation steps, enabling Java and a Maven project with a Pom file.
Set up a java project in IntelliJ using Maven, configure openjdk 21, and explore the project structure with main and test folders and a pom.xml to manage dependencies like playwright.
Create a Maven Java project in IntelliJ, explore the source and main Java directories, and write a Hello World class with a main method that prints hello world.
Learn to create and initialize variables in Java, explore primitive data types like int, double, char, boolean, and string, and print values to the terminal.
Explore primitive data types, declare and initialize variables, and work with arrays and ArrayList in Java, then print values using for loops to the terminal.
Define and call Java methods by creating a class and package, writing public static methods with parameters, returning values, and exploring static versus non-static calls with an instance.
Explore Java control flow with conditional statements and loops, mastering if-else and switch constructs to output messages for positive, negative, and zero values.
Learn to implement for and while loops in Java, iterating with i and count to print values; for loops repeat a number, while loops run while a condition is true.
Explore classes and objects by building an Animal blueprint, using constructors, private fields, and getters. Extend with Dog, override the makeSound method to woof, and instantiate objects to observe behavior.
Define an animal class as a blueprint, extend it to create dog and cat subclasses, override methods and constructors with super, and add unique behaviors like meow, woof, and climb.
Streamline Java projects with Maven by managing dependencies in pom.xml, exploring the project structure, and using lifecycles like clean and compile while adding Playwright for Java.
Learn to debug Java code in IntelliJ using breakpoints, step over, and evaluate expression, while managing dependencies in a Maven pom.xml with Playwright and Selenium.
Create a simple Java program using the JDK’s built-in Scanner to read two numbers and print their sum, avoiding external libraries.
Create and write to a text file in Java using FileWriter from java.io, with a try-catch for IO exceptions. The lecture demonstrates organizing a package and creating examples.txt.
Initially write to a file with file writer, then read it by creating a file object and scanning lines to print them to the console for verification.
Explore how to handle Java errors with try catch blocks, catching specific exceptions, and printing customized messages, including cases with parsing integers and deciding when to ignore or throw errors.
Explore essential java libraries, including apache commons and google guava, add them via the maven pom.xml, pull dependencies from the maven repository, and run practical string and collection exercises.
Explore using external Java libraries like Apache Commons and Google Guava through Maven dependencies to add string utilities, validate emptiness, reverse strings, and join strings with Joiner.
Create a new maven java project in IntelliJ named playwright-automation-framework, add the Playwright dependency from the MVVM repository in pom.xml, and download sources and docs.
Create a simple Playwright test in Java by launching chromium, setting the viewport, navigating to WebDriver University, printing the page title, and closing the browser.
Learn how to install cucumber for Java and cucumber for testing by adding Maven dependencies to your pom.xml, bridging Playwright automation with cucumber as a layer on top.
Integrate cucumber into IntelliJ by installing the cucumber for Java plugin from the marketplace and enabling it in settings; use the plugin to support automation tests in Java.
Organize a maven project’s folder structure to support cucumber and playwright, creating source main and test, packages runner and step_definitions, and resources/features for a simple, scalable automation framework.
Explore the difference between Cucumber and Gherkin, describe how Gherkin's given when then structure maps to feature files and scenarios, and show how step definitions and Playwright automate tests.
Leverage cucumber and gherkin to capture a positive contact us scenario on the contact us page, mapping steps with given, when, and then in a feature file for automation.
Create a cucumber runner class to configure and run tests, enabling reports. Point features and glue paths with cucumber options and extend an abstract class for a robust setup.
Map each step to actions with the cucumber runner and playwright to interact with WebDriver University pages, and create step templates plus separate home page and contact us step files.
Implement two cucumber steps with Playwright in Java: initialize page and browser context, navigate to the home page, and click the contact us link using role-based locators.
Explore locator strategies for Playwright with Java, using XPath and CSS selectors to identify elements and manually craft robust selectors, switching between Chromium and Firefox.
Learn to navigate new browser tabs in Playwright with cucumber, switch to the most recent tab, wait for pages, and share state across steps using hooks.
Create a browser manager to centralize Playwright setup and teardown, enabling shared browser context and page state across steps while applying the dry principle.
Master cucumber hooks in a Java BDD framework with a browser manager and before all, after all, before each, and after each hooks, via Pico container for setup and teardown.
Learn to integrate a browser manager with cucumber hooks for before and after scenario setup and teardown, using Pico container for clean dependency injection, shared state, and DRY principles.
Finalize a cucumber bdd test for the positive scenario by sharing the page state with a browser manager, applying robust selectors, timeouts, and assertions to validate the contact us submission.
Explore designing negative scenarios with cucumber and playwright in Java, validating error messages for invalid emails, updating feature files, and implementing dynamic assertions with regex to ensure failures and successes.
Review how to create feature files with given when then, map steps to playwright actions, and use runner, hooks, and a browser manager with pico container for dependency injection.
Explore cucumber regular expressions to drive data in scenarios by using parameter types such as string and integer, and pass specific data into the WebDriver University contact us form.
Learn cucumber expressions to map step definitions with string and integer parameters, add template steps, and print first name, last name, and email to the console.
Leverage cucumber expressions to implement step definitions with Playwright by substituting values with new parameters, validating input fields like first name, last name, and email, and debugging in run mode.
Explore generating random data with Data Faker in a Java cucumber BDD project, including adding the Data Faker dependency to pom.xml and using random names and emails in steps.
Implement random data generation in cucumber steps using data faker by initializing a faker instance and invoking name.firstName, name.lastName, and internet.emailAddress to populate test inputs.
Explore scenario outlines to reduce duplication by parameterizing usernames and passwords with an examples table. Learn how to map steps to data and run multiple login scenarios efficiently.
Discover how to create and leverage scenario outlines in cucumber for the contact us page on WebDriver University. Learn to define outlines, use examples, and reuse steps across scenarios.
Map and implement cucumber scenario outlines with an examples table in a Java Playwright BDD workflow, covering first name and email steps across three scenarios.
Map and implement dynamic steps for scenario outlines, validating success and error messages using a dynamic xpath, extracting text from h1 or body elements, and asserting with test ng.
Use the background keyword to run common steps before every scenario, reducing duplication and improving feature file readability.
Apply the background keyword to define preconditions, reduce code duplication with the dry principle, and move repeated steps into a shared background for all scenarios.
practice building a Playwright and Cucumber BDD login feature, with two scenarios: valid login and invalid login, by entering a username and password and clicking login, observing validation messages.
Create a login feature file within your automation framework, using a feature keyword and scenario outline to validate valid and invalid credentials for the WebDriver University login portal.
Map out Cucumber scenario requirements for a login portal, using a scenario outline, parameterized steps for username and password, and expected alert validation to drive reusable step definitions.
Map and implement cucumber step definitions for a login feature, using a runner to target the feature file and wiring steps in home and login steps with a browser manager.
Implement and validate alert handling in Cucumber with Playwright by capturing the alert text via the dialog event, accepting the alert, and asserting it matches the expected message.
Learn to use cucumber tags to control scenario execution across feature files, using the at symbol, top-of-file tags like regression and smoke, with practical multi-file examples.
Learn how to use and combine tags like regression, contact, login and smoke in cucumber bdd with java, through real-world examples and runner configurations to target specific scenario groups.
Learn to ignore specific scenarios in Cucumber by tagging them, including smoke and feature-wide ignores, and control execution via the runner class; remove ignore to run all again.
This course uses the latest versions of Playwright & Cucumber BDD.
Why Playwright?
Playwright is a multi-programming language end-to-end testing framework that is not only popular but also rapidly growing in popularity due to its outstanding features and ease of use.
Why Cucumber BDD?
Cucumber BDD (Behaviour-driven development) much like 'Playwright' is a technology which is growing in popularity by the day and is used by organisations across the globe. Cucumber BDD captures test requirements in a simplistic manner, making it easy not only for 'Non technical parties/people' to understand scenario's which have been automated, but also assists the process of building effective automation frameworks and tests.
Why this course?
This course is designed to be quick, effective, efficient and easy to follow. I have been teaching for several years on Udemy with over 9 highly successful courses to date. I have refined this course using proven teaching techniques. This course is carefully structured from start to finish and I provide downloadable code examples after each coding lecture.
What does this course cover?
Introduction to Playwright, Cucumber, and Java:
Learn how to rapidly create both simplistic and sophisticated automated UI tests using Playwright.
Understand the importance of Cucumber BDD (Behaviour-Driven Development).
Capture test (scenario) requirements effectively and effortlessly using Cucumber BDD.
Gain knowledge of ‘Gherkin’, Cucumber’s language parser.
Know why and when to use specific Gherkin keywords such as ‘Feature’, ‘Given’, ‘When’, ‘And’, ‘Then’, and more!
Learn the differences between ‘Scenarios’ and ‘Scenario Outlines’.
Simplify tests using specific Cucumber BDD features such as the ‘Background’ keyword.
Insert and modify test data directly within feature files.
Correctly map test requirements to actions using Cucumber step definitions and Playwright.
Become familiar with ‘Tags’ and learn how to target and execute specific tests (scenarios).
Programming and Tools:
Learn Java & Maven to enhance your testing capabilities.
Understand the fundamentals of Java and how it integrates with Playwright.
Manage project dependencies and build automation effectively using Maven.
Utilize Playwright for browser automation tasks.
Advanced Testing Techniques:
Understand the importance of design patterns such as Page Object Modelling (POM).
Learn best practices such as DRY (Don’t Repeat Yourself).
Leverage ‘Hooks’ and ‘Custom Commands’.
Reporting and Continuous Integration:
Create sophisticated reports (HTML reports, JSON reports) and more!
Learn continuous integration using Jenkins and understand its usefulness.
Become familiar with important add-ons for Jenkins.
Create visually appealing reports within Jenkins and attach images to those reports.
Handle extensible choice parameters (selection dropdown lists) via Jenkins.
Additional Features:
And much, much more!
Ready to automate your tests like a pro!