In-memory Automated UI Testing ASP.NET Core

Introduction

In this article, we look at how to run in-memory automated UI tests for an ASP.NET Core web app using Playwright and NUnit. The article provides demo code and solutions to issues found along the way.

Automated UI Testing

Automated testing of any web application is essential to ensure it functions correctly.  On the top of the “testing pyramid” proudly sits UI testing or end-to-end testing, above integration and unit testing.  Automated UI testing involves launching and controlling a browser to drive through a set of interactions that a user would perform.  Assertions are made to see if the web app and browser behave as expected.  Browsers are controlled by testing tools such as Selenium,  Puppeteer, or the new kid on the block, Playwright.

Automated Testing on UI: Is it Really Worth the Effort?

During engineering and software development, testing is considered an essential aspect of development. However, some developers don’t consider it vital, especially if they have limited time.

This has led to a lot of debate asking if automated testing of UI is essential or not. Well, developers have varying opinions, but if we see it objectively, we believe that automated testing is essential for the following reasons: