Automated Business Readable Web Tests with Selenium and SpecFlow

Learn how to write automated browser UI tests that catch errors other types of tests miss. This course will teach you how to use Selenium and SpecFlow to perform automated, end-to-end testing with efficiency and accuracy.
Course info
Rating
(101)
Level
Intermediate
Updated
May 5, 2016
Duration
2h 24m
Table of contents
Description
Course info
Rating
(101)
Level
Intermediate
Updated
May 5, 2016
Duration
2h 24m
Description

Unit and integration tests can help you catch a range of bugs, but not all aspects can be covered at this level of testing. Even if the unit and integration tests pass, you could still open up your web app only to see it fail because of errors, even at the production stage. This course, Automated Business Readable Web Tests with Selenium and SpecFlow, will show you how to prevent failure from happening. First, you'll learn about why you might want to use automated tests--as well, you'll be introduced to Selenium, learn how it talks to web drivers, and how to create tests inside of it. Next, you'll see how you can put SpecFlow into the mix to make these tests business-readable and learn about some common maintainability issues. Finally, you'll learn how to use page object models to create test code that is more easily maintained. By the end of this course, you will have the skills you need to create tests that will catch even the smallest errors, and as a result, you'll be able to create better, more fail-safe apps.

About the author
About the author

With over 15 years experience, Jason Roberts is a Microsoft .NET MVP, freelance developer, and author.

More from the author
Working with Files and Streams in C#
Intermediate
3h 13m
Oct 12, 2018
Error Handling in C# with Exceptions
Intermediate
1h 37m
Aug 6, 2018
More courses by Jason Roberts
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone, my name is Jason Roberts. Welcome to my course, Automated Business Readable Web Tests with Selenium and SpecFlow. I'm a Microsoft. net MVP free-lance developer and author. In this course, we're going to learn how we can write automated tests that manipulate our web apps through the browser, just as if a real-life user were using it. We'll learn how this can help us find errors other types of tests cannot, and how we can make the tests easily readable by business people. In doing so, we can reduce the possibility of miscommunication, and of us wasting time building the wrong features. Some of the major topics that we'll cover in this course include why we might want to write business readable web UI tests, how to locate and interact programmatically with HTML elements, and how to create more maintainable test code. By the end of this course, you'll know how to use SpecFlow and Selenium to ensure the web app you're building is doing the right thing, and by making the tests business readable, how to increase understanding for all concerned on what features the development team is building. Before beginning this course, you should be familiar with using Visual Studio to write C# code. I hope you'll join me on this journey with the Automated Business Readable Web Tests with Selenium and SpecFlow course at Pluralsight.

Getting Started with Selenium
Hi, welcome back. In the previous module, we got an overview of Selenium and also how SpecFlow can bridge the communications gap. In this module, we're going to be getting better acquainted with Selenium, and we're going to learn how we can automate the browser to create our automated web UI tests. So in this module, we're going to start off by getting an overview of WebDriver, so we're going to learn about the IWebDriver interface, and also the inheritance hierarchy around the WebDriver API. Next we're going to learn some of the different ways that we can select HTML elements on the page in our browser. So we'll learn that we can select elements by ID, by name, and even by css class. We'll then jump into a demo and see how we can install the relevant NuGet packages into our test project in Visual Studio, and then we'll go ahead and write our first test using Selenium WebDriver. So, in the first test, we're going to keep it relatively simple. We're going to load the home page, and click the button that takes us to the application page. We're then going to assert that the correct page was loaded. We'll then go and write a more detailed second test that's actually going to populate and submit the loan application form. This will involve selecting different types of HTML elements, so for example, selecting an input text box and typing text into it, and selecting a specific radio button option.

Creating More Maintainable Web Automation
Hi, welcome back to this final module. In the previous module, we saw how we can create business readable UI tests by incorporating Selenium and SpecFlow together. In this module, we're going to see how we can create more maintainable web automation. So, even though our automated web tests can help us catch problems before they get to production, we don't want them to become a big mess of unmaintainable code. In this module, we're going to see how we can improve the readability and also reduce duplication in our test code by using a concept called page object models. So in this module, we're going to start off by getting an introduction to page object models. So we're going to learn how they help us insulate our test code from changes in the UI, so for example, the ID of an HTML element changing, how they help us to reduce test code duplication to improve the maintainability, and also how they can help to improve the readability of our test code. So, for example, the code that we write in the steps class method. We'll then jump into Visual Studio and we'll go ahead and create page object model classes for both the loan application form and also the application confirmation page. Once we have our page object model classes, we'll go and refactor the code in our SpecFlow steps to use these new page objects. Finally, we'll look at some of the additional support that Selenium provides us by installing an additional Selenium NuGet package and seeing an alternative method for creating our page object models.