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.

Comparison of Object Mapper Libraries

In this article, we look at object-to-object mappers in C# .NET.  Mappers solve the common problem of writing mundane and repetitive code when assigning values between objects.  Three different mapping libraries are evaluated to give an idea of common themes and some differences which might be relevant for your development needs.

The mapping libraries AutoMapper, AgileMapper, and Mapster have been used in a simple demo program to explore some simple mapping scenarios.