Skip to content

Commit

Permalink
More additions, tweaks, and updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Sep 9, 2024
1 parent c871034 commit f9155e6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/fundamentals/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ zone_pivot_groups: unit-testing-framework

# Testing .NET Aspire solutions

In this article, you learn how to create a test project, write, and run tests for your .NET Aspire solutions. The tests in this article are not unit tests, but rather functional or integration tests. .NET Aspire includes several variations of [testing project templates](setup-tooling.md#net-aspire-project-templates) that you use to test your .NET Aspire resource dependencies—and their communications. The testing project templates are available for MSTest, NUnit, and xUnit testing frameworks and includes a sample test that you can use as a starting point for your tests.
In this article, you learn how to create a test project, write, and run tests for your .NET Aspire solutions. The tests in this article aren't unit tests, but rather functional or integration tests. .NET Aspire includes several variations of [testing project templates](setup-tooling.md#net-aspire-project-templates) that you use to test your .NET Aspire resource dependencies—and their communications. The testing project templates are available for MSTest, NUnit, and xUnit testing frameworks and include a sample test that you can use as a starting point for your tests.

The .NET Aspire test project templates rely on the [Aspire.Hosting.Testing](https://www.nuget.org/packages/Aspire.Hosting.Testing) NuGet package. This package exposes the `DistributedApplicationTestingBuilder` class, which is used to create a test host for your distributed application. The distributed application testing builder relies on the `DistributedApplication` class to create and start the [app host](app-host-overview.md).

Expand Down Expand Up @@ -128,6 +128,8 @@ The preceding code:

By using the .NET Aspire testing project template, you can easily create test projects for your .NET Aspire solutions. The template project includes a sample test that you can use as a starting point for your tests. The `DistributedApplicationTestingBuilder` follows a familiar pattern to the `WebApplicationFactory` in ASP.NET Core. It allows you to create a test host for your distributed application and run tests against it.

Finally, when using the `DistributedApplicationTestingBuilder` all resource logs are redirected to the `DistributedApplication` by default. With resource logs being redirected, it enables scenarios where you want to assert that a resource is logging correctly.

## See also

- [Unit testing C# in .NET using dotnet test and xUnit](/dotnet/core/testing/unit-testing-with-dotnet-test)
Expand Down

0 comments on commit f9155e6

Please sign in to comment.