liveBook · Manning

Aspire testing library

As explained in Building Distributed Applications that Work

Aspire.Hosting.Testing is a .NET package that provides components for testing Aspire applications.

Aspire.Hosting.Testing supplies components for integration testing Aspire applications. Its libraries work with xUnit, NUnit, and MSTest; xUnit is the default for the Aspire test-project template. section 6.6.1 section 6.6.2

To prepare a test project for testing the whole Aspire application:

  • Add a reference to the Aspire.Hosting.Testing NuGet package. section 6.6.2
  • Reference the application’s AppHost project from the test project. section 6.6.2
dotnet new aspire-xunit

Create an xUnit Aspire test project with the .NET CLI. section 6.6.1

How Building Distributed Applications that Work covers it

How deep it goes
Specifies test-project dependencies and setup, but stops short of detailing test implementation.
Examples
Uses an OnlineShop.Tests xUnit project and the aspire-xunit template command.
What it assumes
Assumes an existing Aspire application and demonstrates creating a test project and adding Aspire dependencies.
What you can do after
Configure a .NET test project for Aspire integration testing by adding the package and AppHost reference.
How it connects
Connects Aspire integration testing to .NET test projects, AppHost, xUnit, NUnit, and MSTest.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Distributed Applications that Work. The section links point to the parts of the book it draws on.