Microsoft.AspNetCore.Mvc.Testing
10.0.0-preview.1.25120.3
Prefix Reserved
dotnet add package Microsoft.AspNetCore.Mvc.Testing --version 10.0.0-preview.1.25120.3
NuGet\Install-Package Microsoft.AspNetCore.Mvc.Testing -Version 10.0.0-preview.1.25120.3
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0-preview.1.25120.3" />
paket add Microsoft.AspNetCore.Mvc.Testing --version 10.0.0-preview.1.25120.3
#r "nuget: Microsoft.AspNetCore.Mvc.Testing, 10.0.0-preview.1.25120.3"
// Install Microsoft.AspNetCore.Mvc.Testing as a Cake Addin #addin nuget:?package=Microsoft.AspNetCore.Mvc.Testing&version=10.0.0-preview.1.25120.3&prerelease // Install Microsoft.AspNetCore.Mvc.Testing as a Cake Tool #tool nuget:?package=Microsoft.AspNetCore.Mvc.Testing&version=10.0.0-preview.1.25120.3&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
- Microsoft.AspNetCore.TestHost (>= 10.0.0-preview.1.25120.3)
- Microsoft.Extensions.DependencyModel (>= 10.0.0-preview.1.25080.5)
- Microsoft.Extensions.Hosting (>= 10.0.0-preview.1.25080.5)
NuGet packages (231)
Showing the top 5 NuGet packages that depend on Microsoft.AspNetCore.Mvc.Testing:
Package | Downloads |
---|---|
Alba
Supercharged integration testing for ASP.NET Core HTTP endpoints |
|
Ardalis.HttpClientTestExtensions
Helpful extension methods to use when testing APIs in Functional Tests with xUnit. |
|
Volo.Abp.AspNetCore.TestBase
Package Description |
|
Reo.Core.IntegrationTesting
Package Description |
|
FastEndpoints.Testing
Integration/End-To-End testing helper library for FastEndpoints |
GitHub repositories (281)
Showing the top 5 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).
|
Version | Downloads | Last updated | |
---|---|---|---|
10.0.0-preview.1.25120.3 | 1,421 | 2/25/2025 | |
9.0.3 | 0 | 3/11/2025 | |
9.0.2 | 466,503 | 2/11/2025 | |
9.0.1 | 708,308 | 1/14/2025 | |
9.0.0 | 1,479,462 | 11/12/2024 | |
9.0.0-rc.2.24474.3 | 34,794 | 10/8/2024 | |
9.0.0-rc.1.24452.1 | 18,155 | 9/10/2024 | |
9.0.0-preview.7.24406.2 | 7,000 | 8/13/2024 | |
9.0.0-preview.6.24328.4 | 10,683 | 7/9/2024 | |
9.0.0-preview.5.24306.11 | 3,212 | 6/11/2024 | |
9.0.0-preview.4.24267.6 | 2,193 | 5/21/2024 | |
9.0.0-preview.3.24172.13 | 69,655 | 4/11/2024 | |
9.0.0-preview.2.24128.4 | 3,263 | 3/12/2024 | |
9.0.0-preview.1.24081.5 | 23,747 | 2/13/2024 | |
8.0.14 | 0 | 3/11/2025 | |
8.0.13 | 408,233 | 2/11/2025 | |
8.0.12 | 747,244 | 1/14/2025 | |
8.0.11 | 2,562,587 | 11/12/2024 | |
8.0.10 | 3,991,442 | 10/8/2024 | |
8.0.8 | 5,106,224 | 8/13/2024 | |
8.0.7 | 3,701,435 | 7/9/2024 | |
8.0.6 | 3,384,189 | 5/28/2024 | |
8.0.5 | 1,516,115 | 5/14/2024 | |
8.0.4 | 3,713,706 | 4/9/2024 | |
8.0.3 | 2,667,009 | 3/12/2024 | |
8.0.2 | 2,666,570 | 2/13/2024 | |
8.0.1 | 3,054,173 | 1/9/2024 | |
8.0.0 | 3,978,382 | 11/14/2023 | |
8.0.0-rc.2.23480.2 | 56,425 | 10/10/2023 | |
8.0.0-rc.1.23421.29 | 48,803 | 9/12/2023 | |
8.0.0-preview.7.23375.9 | 10,302 | 8/8/2023 | |
8.0.0-preview.6.23329.11 | 27,501 | 7/11/2023 | |
8.0.0-preview.5.23302.2 | 12,640 | 6/13/2023 | |
8.0.0-preview.4.23260.4 | 214,837 | 5/16/2023 | |
8.0.0-preview.3.23177.8 | 3,229 | 4/11/2023 | |
8.0.0-preview.2.23153.2 | 2,002 | 3/14/2023 | |
8.0.0-preview.1.23112.2 | 40,904 | 2/21/2023 | |
7.0.20 | 338,517 | 5/28/2024 | |
7.0.19 | 58,650 | 5/14/2024 | |
7.0.18 | 159,361 | 4/9/2024 | |
7.0.17 | 317,871 | 3/12/2024 | |
7.0.16 | 346,029 | 2/13/2024 | |
7.0.15 | 516,887 | 1/9/2024 | |
7.0.14 | 893,866 | 11/14/2023 | |
7.0.13 | 1,522,272 | 10/24/2023 | |
7.0.12 | 682,100 | 10/10/2023 | |
7.0.11 | 2,368,703 | 9/12/2023 | |
7.0.10 | 1,337,163 | 8/8/2023 | |
7.0.9 | 1,179,642 | 7/11/2023 | |
7.0.8 | 860,657 | 6/22/2023 | |
7.0.7 | 430,545 | 6/13/2023 | |
7.0.5 | 2,738,471 | 4/11/2023 | |
7.0.4 | 1,581,555 | 3/14/2023 | |
7.0.3 | 1,417,128 | 2/14/2023 | |
7.0.2 | 1,451,613 | 1/10/2023 | |
7.0.1 | 827,414 | 12/13/2022 | |
7.0.0 | 2,445,859 | 11/7/2022 | |
7.0.0-rc.2.22476.2 | 65,640 | 10/11/2022 | |
7.0.0-rc.1.22427.2 | 21,470 | 9/14/2022 | |
7.0.0-preview.7.22376.6 | 7,541 | 8/9/2022 | |
7.0.0-preview.6.22330.3 | 2,405 | 7/12/2022 | |
7.0.0-preview.5.22303.8 | 9,281 | 6/14/2022 | |
7.0.0-preview.4.22251.1 | 2,062 | 5/10/2022 | |
7.0.0-preview.3.22178.4 | 1,202 | 4/13/2022 | |
7.0.0-preview.2.22153.2 | 962 | 3/14/2022 | |
7.0.0-preview.1.22109.13 | 4,973 | 2/17/2022 | |
6.0.36 | 272,938 | 11/12/2024 | |
6.0.35 | 154,877 | 10/8/2024 | |
6.0.33 | 624,103 | 8/13/2024 | |
6.0.32 | 241,532 | 7/9/2024 | |
6.0.31 | 381,975 | 5/28/2024 | |
6.0.30 | 135,617 | 5/14/2024 | |
6.0.29 | 588,419 | 4/9/2024 | |
6.0.28 | 354,871 | 3/12/2024 | |
6.0.27 | 543,403 | 2/13/2024 | |
6.0.26 | 802,225 | 1/9/2024 | |
6.0.25 | 1,422,517 | 11/14/2023 | |
6.0.24 | 780,260 | 10/24/2023 | |
6.0.23 | 518,467 | 10/10/2023 | |
6.0.22 | 851,072 | 9/12/2023 | |
6.0.21 | 1,223,463 | 8/8/2023 | |
6.0.20 | 1,118,299 | 7/11/2023 | |
6.0.19 | 687,225 | 6/22/2023 | |
6.0.18 | 448,352 | 6/13/2023 | |
6.0.16 | 2,333,233 | 4/11/2023 | |
6.0.15 | 1,247,234 | 3/14/2023 | |
6.0.14 | 1,619,282 | 2/14/2023 | |
6.0.13 | 2,100,143 | 1/10/2023 | |
6.0.12 | 2,378,768 | 12/13/2022 | |
6.0.11 | 2,603,106 | 11/7/2022 | |
6.0.10 | 3,995,782 | 10/11/2022 | |
6.0.9 | 3,055,617 | 9/13/2022 | |
6.0.8 | 3,880,376 | 8/9/2022 | |
6.0.7 | 3,317,720 | 7/12/2022 | |
6.0.6 | 2,433,016 | 6/14/2022 | |
6.0.5 | 3,058,002 | 5/10/2022 | |
6.0.4 | 2,788,759 | 4/11/2022 | |
6.0.3 | 3,037,239 | 3/8/2022 | |
6.0.2 | 2,926,510 | 2/8/2022 | |
6.0.1 | 4,274,089 | 12/14/2021 | |
6.0.0 | 4,751,985 | 11/8/2021 | |
6.0.0-rc.2.21480.10 | 201,203 | 10/12/2021 | |
6.0.0-rc.1.21452.15 | 170,983 | 9/14/2021 | |
6.0.0-preview.7.21378.6 | 7,304 | 8/10/2021 | |
6.0.0-preview.6.21355.2 | 4,125 | 7/14/2021 | |
6.0.0-preview.5.21301.17 | 3,060 | 6/15/2021 | |
6.0.0-preview.4.21253.5 | 2,498 | 5/24/2021 | |
6.0.0-preview.3.21201.13 | 2,828 | 4/8/2021 | |
6.0.0-preview.2.21154.6 | 806 | 3/11/2021 | |
6.0.0-preview.1.21103.6 | 904 | 2/12/2021 | |
5.0.17 | 663,735 | 5/10/2022 | |
5.0.16 | 106,130 | 4/11/2022 | |
5.0.15 | 209,421 | 3/8/2022 | |
5.0.14 | 204,475 | 2/8/2022 | |
5.0.13 | 492,082 | 12/14/2021 | |
5.0.12 | 594,114 | 11/7/2021 | |
5.0.11 | 1,031,395 | 10/12/2021 | |
5.0.10 | 1,050,692 | 9/14/2021 | |
5.0.9 | 1,157,837 | 8/10/2021 | |
5.0.8 | 915,383 | 7/13/2021 | |
5.0.7 | 1,183,398 | 6/8/2021 | |
5.0.6 | 927,843 | 5/11/2021 | |
5.0.5 | 1,357,813 | 4/6/2021 | |
5.0.4 | 820,378 | 3/9/2021 | |
5.0.3 | 981,684 | 2/9/2021 | |
5.0.2 | 934,248 | 1/12/2021 | |
5.0.1 | 563,068 | 12/8/2020 | |
5.0.0 | 1,567,165 | 11/9/2020 | |
5.0.0-rc.2.20475.17 | 14,853 | 10/13/2020 | |
5.0.0-rc.1.20451.17 | 7,724 | 9/14/2020 | |
5.0.0-preview.8.20414.8 | 9,091 | 8/25/2020 | |
5.0.0-preview.7.20365.19 | 3,535 | 7/21/2020 | |
5.0.0-preview.6.20312.15 | 1,989 | 6/25/2020 | |
5.0.0-preview.5.20279.2 | 816 | 6/10/2020 | |
5.0.0-preview.4.20257.10 | 1,446 | 5/18/2020 | |
5.0.0-preview.3.20215.14 | 1,823 | 4/23/2020 | |
5.0.0-preview.2.20167.3 | 819 | 4/2/2020 | |
5.0.0-preview.1.20124.5 | 1,051 | 3/16/2020 | |
3.1.32 | 416,771 | 12/13/2022 | |
3.1.31 | 91,365 | 11/8/2022 | |
3.1.30 | 772,147 | 10/11/2022 | |
3.1.29 | 68,536 | 9/13/2022 | |
3.1.28 | 113,871 | 8/9/2022 | |
3.1.27 | 107,961 | 7/12/2022 | |
3.1.26 | 117,869 | 6/14/2022 | |
3.1.25 | 136,366 | 5/10/2022 | |
3.1.24 | 136,298 | 4/11/2022 | |
3.1.23 | 203,483 | 3/8/2022 | |
3.1.22 | 580,942 | 12/14/2021 | |
3.1.21 | 430,297 | 11/7/2021 | |
3.1.20 | 374,466 | 10/11/2021 | |
3.1.19 | 266,615 | 9/14/2021 | |
3.1.18 | 795,013 | 8/10/2021 | |
3.1.17 | 565,172 | 7/13/2021 | |
3.1.16 | 487,037 | 6/8/2021 | |
3.1.15 | 435,365 | 5/11/2021 | |
3.1.14 | 767,205 | 4/6/2021 | |
3.1.13 | 900,378 | 3/9/2021 | |
3.1.12 | 547,534 | 2/9/2021 | |
3.1.11 | 692,754 | 1/12/2021 | |
3.1.10 | 2,115,032 | 11/9/2020 | |
3.1.9 | 2,311,396 | 10/13/2020 | |
3.1.8 | 2,021,029 | 9/8/2020 | |
3.1.7 | 1,564,552 | 8/11/2020 | |
3.1.6 | 1,756,914 | 7/14/2020 | |
3.1.5 | 2,112,105 | 6/9/2020 | |
3.1.4 | 1,482,232 | 5/12/2020 | |
3.1.3 | 2,388,750 | 3/24/2020 | |
3.1.2 | 1,981,426 | 2/18/2020 | |
3.1.1 | 1,776,982 | 1/14/2020 | |
3.1.0 | 2,130,820 | 12/3/2019 | |
3.1.0-preview3.19555.2 | 2,216 | 11/13/2019 | |
3.1.0-preview2.19528.8 | 999 | 11/1/2019 | |
3.1.0-preview1.19508.20 | 1,464 | 10/15/2019 | |
3.0.3 | 107,753 | 2/18/2020 | |
3.0.2 | 57,674 | 1/14/2020 | |
3.0.0 | 2,840,977 | 9/23/2019 | |
3.0.0-rc1.19457.4 | 10,508 | 9/16/2019 | |
3.0.0-preview9.19424.4 | 5,009 | 9/4/2019 | |
3.0.0-preview8.19405.7 | 14,845 | 8/13/2019 | |
3.0.0-preview7.19365.7 | 5,740 | 7/23/2019 | |
3.0.0-preview6.19307.2 | 4,554 | 6/12/2019 | |
3.0.0-preview5-19227-01 | 13,880 | 5/6/2019 | |
3.0.0-preview4-19216-03 | 1,965 | 4/18/2019 | |
3.0.0-preview3-19153-02 | 1,436 | 3/6/2019 | |
3.0.0-preview-19075-0444 | 3,570 | 1/29/2019 | |
3.0.0-preview-18579-0056 | 3,099 | 12/3/2018 | |
2.3.0 | 1,252 | 1/14/2025 | |
2.2.0 | 6,512,389 | 12/3/2018 | |
2.2.0-preview3-35497 | 15,982 | 10/17/2018 | |
2.2.0-preview2-35157 | 4,091 | 9/12/2018 | |
2.2.0-preview1-35029 | 7,216 | 8/22/2018 | |
2.1.3 | 1,465,455 | 10/1/2018 | |
2.1.2 | 363,082 | 8/21/2018 | |
2.1.1 | 991,503 | 6/18/2018 | |
2.1.0 | 828,722 | 5/29/2018 | |
2.1.0-rc1-final | 20,744 | 5/6/2018 | |
2.1.0-preview2-final | 4,748 | 4/10/2018 | |
2.1.0-preview1-final | 3,710 | 2/26/2018 |