
Welcome to this cours on Serenity BDD Fundamentals - it's great to have you onboard!
The goal of this training is to get you up to speed with how to use Serenity BDD to write high quality web tests using Selenium WebDriver. You'll need some fundamental understanding of Java coding and Java IDEs, and knowing Selenium basics will be helpful. You'll also need a basic understanding of Git and how to use Github to follow along with the sample code.
But I'll be explaining a lot of the basics along the way!
This training is packed with useful information and actionable tips. To get maximum value of the training, if you are on LinkedIn, make sure you join the Agile Test Automation Secrets Group on LinkedIn if you're not already a member (there are lots of useful resources here and a really helpful community!)
You can learn more about the approach and philosophy to agile test automation that we apply in this course in the Test Automation Made Easy ebook, that you can download in the Resources section. (Read this before you start on the course so that you can get the most value out of your learning experience).
Learn what Serenity BDD is about and how it can help you as a tester.
To follow along with the lessons on your own machine, you'll need the following:
Java 17
A Java IDE (we recommend IntelliJ)
Maven 3.6.3
Git (and a Github account)
Serenity BDD is a Java library and needs a recent version of the Java Development Kit to be installed. Serenity needs at least Java 8, but in the examples we will be using exploring Java features and using Java 17.
Install and verify git, configure your global user name and email, and set up a GitHub account to access starter projects and compare sample solutions for exercises.
Learn how to install IntelliJ and set up the sample project that contains the sample code and solutions for all the exercises in this course.
Install and set up Eclipse for Java development, clone the Serenity Web training project from GitHub, import it as a Maven project, and run tests via JUnit or Maven goals.
Discover the overall goals and architecture of the Serenity BDD test automation framework, and learn how to know what version you should use.
Learn how to create your first Serenity BDD project from a Github template project and run your first Serenity BDD test. This is the technique you'll use when you want to create a real-world Serenity BDD project for your day job.
You can create a new Serenity BDD project of your own and follow along using the https://udmlearn.oneclick-cloud.shop/_ud_origin/github.com/serenity-bdd/serenity-junit-starter.git project.
Write your first web test using Serenity BDD and Selenium WebDriver. If you want to follow along with the sample solutions, you can switch to the sample project from https://udmlearn.oneclick-cloud.shop/_ud_origin/github.com/serenity-dojo/serenity-web-training that we set up in the previous module.
Learn how to run a JUnit 4 test with Serenity BDD, and switch to JUnit 5 using Serenity JUnit extension, extendWith, and the correct JUnit Jupiter API test annotation.
In this module we learn how Serenity helps us organise our test code into reusable steps, and take a first look at the famous Serenity reports
Discover how we can use parameters to make our Serenity step methods more flexible and more expressive, and learn how Serenity BDD reports on errors.
Finally, we discover how to organise our scenarios into a requirements hierarchy that will appear in our Serenity reports and make them easier to navigate.
Explore serenity conf in hocon format and curly-bracket grouping for structured test configuration. See how serenity properties override conf values and why sensitive data stays out of version control.
Explore reliable locator strategies for web test automation, including id, class, link text, css, xpath, and data attributes, with guidance on selecting robust options for Serenity and Selenium.
Learn when and how to identify elements using the HTML id attribute.
Learn when and how to locate web elements using the name attribute.
Locating elements using their CSS classes is a powerful way to find elements on a page. That's what we explore in this module.
Explore locating elements by link text or partial link text and verifying navigation to a product details page using a page object approach in Serenity BDD and Selenium.
Locating elements using CSS can be a powerful and elegent approach. Find out more in this module.
Master advanced CSS selectors to identify page elements with precision and readability, using IDs, classes, tags, and attribute selectors, including contains, starts with, ends with, and nth-child.
The last strategy locator strategy we look at is using XPath. Learn how to use XPath to create dynamic locators for more advanced scenarios in this module.
Master css selectors to locate elements via tag, id, class, and attributes with concise expressions; learn their advantages over xpath and note limitations like no dom traversal or text matching.
Identify web elements using CSS selectors by tag, class, or id with precision. Combine selectors to target specific elements, recognizing that IDs are unique and classes may match multiple items.
Explore locating simple elements with css selectors by inspecting the search field and search button, using id or class options, and selecting the most robust locator.
Locate elements by attribute values with square bracket syntax, using name equals or id equals, refine with hat equals for starts with, ends with, and dollar equals for contains text.
Explore CSS selectors to locate web elements by attribute values, using input attributes like type, name, placeholder, and class, and practice robust options for the Wikipedia search field.
Locate elements in the DOM with CSS selectors: use the greater-than sign for direct children and a space for descendants; apply nth child and nth of type to select items.
Master XPath for web test automation by comparing absolute, relative, and exact expressions, and learn to balance robustness with maintainability when locating elements by tag, attributes, and inner text.
Explore how XPath predicates and functions locate page elements with precise conditions, using nested structures, wildcards, attributes, text, contains, and normalization for robust web tests.
Master concise XPath expressions that uniquely identify elements via id, name, or data attributes, and use text content or dot notation to locate text reliably while keeping tests maintainable.
Navigate the dom with XPath to locate elements relative to others, using dot-dot notation, and explore child, parent, ancestor, descendant, and following-sibling locators.
Prioritize data attributes (data test IDs) for locating elements, then IDs and names, then CSS selectors, and only use XPath for text content or complex DOM structures.
One of the most effective ways to organise your test cases is not to model your application pages or fields: it's to model your user's behaviour. In this module, we see how this approach works in more detail.
In this module we refactor our code to take advantage of Action Classes and see how this improves our code and our reports.
See how to use Actions and Page Objects on your own with these exercises.
Try out this first exercise yourself: Write a Serenity BDD test to check that the shopping cart badge is updated correctly when you select an item.
Demonstrates adding multiple items to a cart using a product list, opening the cart, and asserting the displayed items match the selected ones with Serenity BDD and Selenium.
Learn what exactly we mean by the term "Page Object", and why we use Page Objects differently in Serenity BDD.
Find out how Serenity supports the @FindBy annotation in Page Objects.
Although you can use @FindBy annotations, in Serenity BDD page objects these are optional, and often you can write more concise and more flexible code without. Find out how in this lesson.
Learn to automate simple input field interactions with Serenity BDD and Selenium by typing search queries, clicking search, and extracting trimmed product names from results for validation.
The sample code for this lesson can be tound on the sample-code/lesson-12-working-with-checkboxes branch.
The sample code for this lesson can be tound on the sample-code/lesson-13-dropdowns branch.
The sample code for this lesson can be tound on the sample-code/lesson-14-contact-form branch.
The sample code for this lesson can be tound on the sample-code/lesson-15-mouse-interactions branch, in the serenityswag.theinternet package.
Learn why writing great assertions is so key to writing great automated tests, and discover the powerful AssertJ assertion library.
Learn to write fluent assertions with AssertJ, replacing traditional JUnit checks with expressive, chainable tests that cover numbers, collections, contains, has size, and all elements.
Discover how Serenity makes assertions visible by using the step annotation, the Serenity report for explicit expectations, and record report data to inject evidence into test reports.
Explore how implicit waits boost test robustness in Serenity, compare them with explicit waits, and implement dynamic loading handling to wait for results in Selenium-based tests.
Learn how to wait for elements to appear or disappear using Selenium and Serenity, including visibility checks, loading indicators, and optional timeouts.
Serenity BDD is one of the most popular Java test automation libraries, and for good reason!
If you are writing automated web tests in Java, using Serenity BDD correctly can reduce the amount of code you need to write by well over 50%, slashing the amount of code you need to maintain yourself. Serenity BDD produces powerful test reports that you can use both as as evidence of your testing activities and documentation of your application. And with over a million downloads a month, regular releases and a vibrant open source community, it's a solid bet for your test automation framework!
This in-depth video training is designed and delivered by John Ferguson Smart, the author and lead maintainer of Serenity BDD. Constantly updated with the latest Serenity BDD features, this course will give you a unique insight on how to use Serenity BDD the way it is intended. You'll discover:
How to write well-structured automated web tests with Serenity BDD, to maximise reuse and minimise maintenance costs
How to use Page Objects and Action Classes to make your test code more concise and more expressive, so you can write tests faster AND spend less time maintaining them later on;
How to choose effective locator strategies using XPath and CSS, including Serenity BDD's powerful dynamic locators
How to handle waits and asynchronous applications in Serenity BDD, making your tests more stable and robust
How to use data-driven testing with Serenity to get higher coverage and better reporting
How to run tests in parallel and get feedback faster
How to run your Serenity BDD tests remotely on Selenium Grid and services such as SauceLabs and BrowserStack.
How to tailor your Serenity BDD reports, so they tell your stakeholders EXACTLY what they need to know
How to integrate Serenity BDD with JUnit 5, and get all the power of the latest and greatest version of JUnit
And much more
But more importantly, you'll discover the mindset behind the Serenity BDD framework. You'll see live examples of how the framework author uses Serenity BDD to write automated web tests faster and more reliably, and learn how to use the same techniques yourself.
After all, who better to teach you Serenity BDD than the author of the framework himself?
By the end of the course, you'll be able to build automated testing frameworks for your web applications quickly and effectively from scratch, harnessing the full power of Serenity BDD test automation framework.