Microsoft.AspNetCore.Mvc.Testing
10.0.0-preview.4.25255.103
Prefix Reserved
dotnet add package Microsoft.AspNetCore.Mvc.Testing --version 10.0.0-preview.4.25255.103
NuGet\Install-Package Microsoft.AspNetCore.Mvc.Testing -Version 10.0.0-preview.4.25255.103
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0-preview.4.25255.103" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0-preview.4.25255.103" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
paket add Microsoft.AspNetCore.Mvc.Testing --version 10.0.0-preview.4.25255.103
#r "nuget: Microsoft.AspNetCore.Mvc.Testing, 10.0.0-preview.4.25255.103"
#addin nuget:?package=Microsoft.AspNetCore.Mvc.Testing&version=10.0.0-preview.4.25255.103&prerelease
#tool nuget:?package=Microsoft.AspNetCore.Mvc.Testing&version=10.0.0-preview.4.25255.103&prerelease
About
Microsoft.AspNetCore.Mvc.Testing
provides support for writing integration tests for ASP.NET Core apps that utilize MVC or Minimal APIs.
Key Features
- Copies the dependencies file (
.deps.json
) from the System Under Test (SUT) into the test project'sbin
directory - Sets the content root to the SUT's project root so that static files are found during test execution
- Provides the
WebApplicationFactory
class to streamline bootstrapping the SUT withTestServer
How to Use
To use Microsoft.AspNetCore.Mvc.Testing
, follow these steps:
Installation
To install the package, run the following command from the directory containing the test project file:
dotnet add package Microsoft.AspNetCore.Mvc.Testing
Configuration
To configure the test app, follow these steps:
- Specify the Web SDK in the test project file (
<Project Sdk="Microsoft.NET.Sdk.Web">
). - Add references to the following packages:
xunit
xunit.runner.visualstudio
Microsoft.NET.Test.Sdk
- Add a test class to the test project:
public class BasicTests : IClassFixture<WebApplicationFactory<Program>> { private readonly WebApplicationFactory<Program> _factory; public BasicTests(WebApplicationFactory<Program> factory) { _factory = factory; } [Theory] [InlineData("/")] [InlineData("/Index")] [InlineData("/About")] [InlineData("/Privacy")] [InlineData("/Contact")] public async Task Get_EndpointsReturnSuccessAndCorrectContentType(string url) { // Arrange var client = _factory.CreateClient(); // Act var response = await client.GetAsync(url); // Assert response.EnsureSuccessStatusCode(); // Status Code 200-299 Assert.Equal("text/html; charset=utf-8", response.Content.Headers.ContentType.ToString()); } }
Additional Documentation
For additional documentation and examples, refer to the official documentation on integration testing in ASP.NET Core.
Feedback & Contributing
Microsoft.AspNetCore.Mvc.Testing
is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.TestHost (>= 10.0.0-preview.4.25255.103)
- Microsoft.Extensions.DependencyModel (>= 10.0.0-preview.4.25255.103)
- Microsoft.Extensions.Hosting (>= 10.0.0-preview.4.25255.103)
GitHub repositories (294)
Showing the top 20 popular GitHub repositories that depend on Microsoft.AspNetCore.Mvc.Testing:
Repository | Stars |
---|---|
jellyfin/jellyfin
The Free Software Media System - Server Backend & API
|
|
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
|
|
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
|
|
ardalis/CleanArchitecture
Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 9
|
|
bitwarden/server
Bitwarden infrastructure/backend (API, database, Docker, etc).
|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
aspnetboilerplate/aspnetboilerplate
ASP.NET Boilerplate - Web Application Framework
|
|
dotnet-architecture/eShopOnWeb
Sample ASP.NET Core 8.0 reference application, now community supported: https://github.com/NimblePros/eShopOnWeb
|
|
dodyg/practical-aspnetcore
Practical samples of ASP.NET Core 10 Preview 4, 9, 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects.
|
|
dotnet/eShop
A reference .NET application implementing an eCommerce site
|
|
OrchardCMS/OrchardCore
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
|
|
elsa-workflows/elsa-core
A .NET workflows library
|
|
quartznet/quartznet
Quartz Enterprise Scheduler .NET
|
|
graphql-dotnet/graphql-dotnet
GraphQL for .NET
|
|
Azure/azure-sdk-for-net
This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
|
|
kurrent-io/KurrentDB
EventStoreDB, the event-native database. Designed for Event Sourcing, Event-Driven, and Microservices architectures
|
|
domaindrivendev/Swashbuckle.AspNetCore
Swagger tools for documenting API's built on ASP.NET Core
|
|
FastEndpoints/FastEndpoints
A light-weight REST API development framework for ASP.NET 8 and newer.
|
|
jasontaylordev/NorthwindTraders
Northwind Traders is a sample application built using ASP.NET Core and Entity Framework Core.
|
Version | Downloads | Last updated |
---|---|---|
10.0.0-preview.4.25255.103 | 0 | 5/12/2025 |
3.0.0-preview-19075-0444 | 1 | 1/28/2019 |
3.0.0-preview-18579-0056 | 1 | 11/30/2018 |
3.0.0-preview-18579-0053 | 1 | 11/30/2018 |