Testing web services using xUnit
There are multiple ways to test web services:
- Automatically using testing frameworks like xUnit, NUnit, and MSTest.
- Manually using HTTP request editors like REST Client for VS Code or HTTP Editor in Visual Studio.
- Manually using GUI tools like Postman, NSwag, or Swagger UI.
Warning!
Swagger UI integration using the Swashbuckle package has been removed in the ASP.NET Core 9 project templates. You can learn more about this at the following link: https://github.com/dotnet/aspnetcore/issues/54599. The ASP.NET Core team have replaced the OpenAPI document generation with a built-in feature, but they have no plans to replace the Swagger user interface for testing.
Unit testing using xUnit
xUnit.net, often simply referred to as xUnit, is a popular unit testing framework for the .NET ecosystem. xUnit has been specifically designed to address some of the limitations found in older testing frameworks like NUnit and MSTest.
Even internal Microsoft teams avoid...