Skip to content

Why Automated Testing?

What Is UI Testing and Why Do We Care?

UI testing is the process of validating the user interface of an application. Typically UI tests will focus on several key aspects:

  • Usability
  • Compatibility
  • Consistency

Although Unit Tests allow us to validate low-level application logic, it fails to capture how the website will actually behave to a real user. A Unit Test that verifies data can be processed and sent to a backend service does not speak to whether or not a form renders correctly. It also fails to validate that it will function correctly across alternate browsers or with unique User Agents.

UI Testing allows us to think about the customer and how they will interact with our web app. Making UI Testing a part of our delivery process will ensure that key functionality is working before a new version is delivered to our end users.

Automated Testing

In the past UI Testing may have occurred at many stages of the delivery pipeline, often by multiple teams. This process is typically a manual one with testers clicking through pages and dialogs on their machine to validate functionality. While manual testing can be helpful for development and peace-of-mind, until tests are run automatically in a delivery pipeline we'll always be risking consistency between releases.

Defining our tests as code and utilizing automated UI testing tools allows us to perform the same tests, the same way every time we trigger our pipeline execution. As a result, we can catch breaking changes earlier in our delivery process and quickly iterate on a fix.

Discussion

Discuss with the team pros/cons of approaches to UI testing.

Selenium

The Selenium Browser Automation Project is an umbrella project for a variety of tools and code libraries that support the automation of Web Browsers. Extensions can emulate user interaction and it provides infrastructure for writing interchangeable code for major web browsers. We'll be using the C# variant of Selenium to automate UI Testing for our ModelApp and use the Edge WebDriver to create instances of a web browser.

There are many tools that enable automated testing patterns depending on the tool stack for your application. For the purposes of this lab, we'll be using Selenium but the larger patterns can be utilized in other frameworks.