Creating end-to-end .NET Playwright tests
Microsoft Playwright (https://playwright.dev) offers tools and libraries from Microsoft for web tests, which include tests on web APIs.
Playwright offers several tools (including generating tests by recording actions with web pages, inspecting web pages, generating selectors, and viewing traces), tests across different platforms, and test libraries for TypeScript, JavaScript, Python, .NET, and Java. With UI automation, Playwright can replace manual testers! Here, we’ll use Playwright to test APIs – using .NET!
Creating a test project with Playwright
Let’s start creating a test project with Playwright. Because xUnit has a focus on unit tests and there’s an issue with limiting concurrent test runs, Playwright supports NUnit and MSTest. Here, we use NUnit:
dotnet new nunit -o Codebreaker.GameAPIs.Playwright cd Codebreaker.GameAPIs.Playwright dotnet add package Microsoft.Playwright.NUnit dotnet build
Using...