Microsoft.AspNetCore.Mvc.Testing
10.0.0-preview.1.25120.3
Prefix Reserved
See the version list below for details.
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" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0-preview.1.25120.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
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"
#addin nuget:?package=Microsoft.AspNetCore.Mvc.Testing&version=10.0.0-preview.1.25120.3&prerelease
#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 (234)
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 (278)
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.2.25164.1 | 1,394 | 19 days ago | |
10.0.0-preview.1.25120.3 | 2,453 | a month ago | |
9.0.3 | 451,285 | a month ago | |
9.0.2 | 743,924 | 2 months ago | |
9.0.1 | 863,469 | 3 months ago | |
9.0.0 | 1,723,537 | 5 months ago | |
9.0.0-rc.2.24474.3 | 36,993 | 6 months ago | |
9.0.0-rc.1.24452.1 | 18,635 | 7 months ago | |
9.0.0-preview.7.24406.2 | 7,032 | 8 months ago | |
9.0.0-preview.6.24328.4 | 10,751 | 9 months ago | |
9.0.0-preview.5.24306.11 | 3,228 | 10 months ago | |
9.0.0-preview.4.24267.6 | 2,224 | 5/21/2024 | |
9.0.0-preview.3.24172.13 | 69,676 | 4/11/2024 | |
9.0.0-preview.2.24128.4 | 3,318 | 3/12/2024 | |
9.0.0-preview.1.24081.5 | 23,918 | 2/13/2024 | |
8.0.14 | 350,832 | a month ago | |
8.0.13 | 775,630 | 2 months ago | |
8.0.12 | 959,315 | 3 months ago | |
8.0.11 | 2,987,497 | 5 months ago | |
8.0.10 | 4,456,215 | 6 months ago | |
8.0.8 | 5,516,821 | 8 months ago | |
8.0.7 | 3,952,137 | 9 months ago | |
8.0.6 | 3,594,335 | 5/28/2024 | |
8.0.5 | 1,621,238 | 5/14/2024 | |
8.0.4 | 3,949,946 | 4/9/2024 | |
8.0.3 | 2,804,226 | 3/12/2024 | |
8.0.2 | 2,761,630 | 2/13/2024 | |
8.0.1 | 3,154,657 | 1/9/2024 | |
8.0.0 | 4,162,145 | 11/14/2023 | |
8.0.0-rc.2.23480.2 | 56,673 | 10/10/2023 | |
8.0.0-rc.1.23421.29 | 50,377 | 9/12/2023 | |
8.0.0-preview.7.23375.9 | 10,392 | 8/8/2023 | |
8.0.0-preview.6.23329.11 | 27,580 | 7/11/2023 | |
8.0.0-preview.5.23302.2 | 12,676 | 6/13/2023 | |
8.0.0-preview.4.23260.4 | 229,350 | 5/16/2023 | |
8.0.0-preview.3.23177.8 | 3,251 | 4/11/2023 | |
8.0.0-preview.2.23153.2 | 2,012 | 3/14/2023 | |
8.0.0-preview.1.23112.2 | 40,925 | 2/21/2023 | |
7.0.20 | 370,540 | 5/28/2024 | |
7.0.19 | 62,166 | 5/14/2024 | |
7.0.18 | 164,922 | 4/9/2024 | |
7.0.17 | 336,908 | 3/12/2024 | |
7.0.16 | 358,728 | 2/13/2024 | |
7.0.15 | 524,601 | 1/9/2024 | |
7.0.14 | 905,456 | 11/14/2023 | |
7.0.13 | 1,607,365 | 10/24/2023 | |
7.0.12 | 690,266 | 10/10/2023 | |
7.0.11 | 2,479,810 | 9/12/2023 | |
7.0.10 | 1,349,814 | 8/8/2023 | |
7.0.9 | 1,192,515 | 7/11/2023 | |
7.0.8 | 868,896 | 6/22/2023 | |
7.0.7 | 440,761 | 6/13/2023 | |
7.0.5 | 2,778,865 | 4/11/2023 | |
7.0.4 | 1,600,409 | 3/14/2023 | |
7.0.3 | 1,430,685 | 2/14/2023 | |
7.0.2 | 1,461,677 | 1/10/2023 | |
7.0.1 | 834,944 | 12/13/2022 | |
7.0.0 | 2,508,909 | 11/7/2022 | |
7.0.0-rc.2.22476.2 | 65,939 | 10/11/2022 | |
7.0.0-rc.1.22427.2 | 21,600 | 9/14/2022 | |
7.0.0-preview.7.22376.6 | 7,613 | 8/9/2022 | |
7.0.0-preview.6.22330.3 | 2,415 | 7/12/2022 | |
7.0.0-preview.5.22303.8 | 9,292 | 6/14/2022 | |
7.0.0-preview.4.22251.1 | 2,086 | 5/10/2022 | |
7.0.0-preview.3.22178.4 | 1,213 | 4/13/2022 | |
7.0.0-preview.2.22153.2 | 973 | 3/14/2022 | |
7.0.0-preview.1.22109.13 | 5,008 | 2/17/2022 | |
6.0.36 | 472,261 | 5 months ago | |
6.0.35 | 169,004 | 6 months ago | |
6.0.33 | 706,780 | 8 months ago | |
6.0.32 | 252,868 | 9 months ago | |
6.0.31 | 394,402 | 5/28/2024 | |
6.0.30 | 139,046 | 5/14/2024 | |
6.0.29 | 610,539 | 4/9/2024 | |
6.0.28 | 364,806 | 3/12/2024 | |
6.0.27 | 555,471 | 2/13/2024 | |
6.0.26 | 818,908 | 1/9/2024 | |
6.0.25 | 1,456,904 | 11/14/2023 | |
6.0.24 | 789,660 | 10/24/2023 | |
6.0.23 | 529,810 | 10/10/2023 | |
6.0.22 | 866,868 | 9/12/2023 | |
6.0.21 | 1,238,740 | 8/8/2023 | |
6.0.20 | 1,137,325 | 7/11/2023 | |
6.0.19 | 696,349 | 6/22/2023 | |
6.0.18 | 456,230 | 6/13/2023 | |
6.0.16 | 2,361,898 | 4/11/2023 | |
6.0.15 | 1,271,524 | 3/14/2023 | |
6.0.14 | 1,641,377 | 2/14/2023 | |
6.0.13 | 2,131,449 | 1/10/2023 | |
6.0.12 | 2,397,429 | 12/13/2022 | |
6.0.11 | 2,633,037 | 11/7/2022 | |
6.0.10 | 4,032,271 | 10/11/2022 | |
6.0.9 | 3,082,144 | 9/13/2022 | |
6.0.8 | 3,924,738 | 8/9/2022 | |
6.0.7 | 3,345,148 | 7/12/2022 | |
6.0.6 | 2,455,194 | 6/14/2022 | |
6.0.5 | 3,075,503 | 5/10/2022 | |
6.0.4 | 2,814,807 | 4/11/2022 | |
6.0.3 | 3,058,410 | 3/8/2022 | |
6.0.2 | 2,949,514 | 2/8/2022 | |
6.0.1 | 4,308,890 | 12/14/2021 | |
6.0.0 | 4,810,457 | 11/8/2021 | |
6.0.0-rc.2.21480.10 | 201,267 | 10/12/2021 | |
6.0.0-rc.1.21452.15 | 171,123 | 9/14/2021 | |
6.0.0-preview.7.21378.6 | 7,315 | 8/10/2021 | |
6.0.0-preview.6.21355.2 | 4,137 | 7/14/2021 | |
6.0.0-preview.5.21301.17 | 3,069 | 6/15/2021 | |
6.0.0-preview.4.21253.5 | 2,507 | 5/24/2021 | |
6.0.0-preview.3.21201.13 | 2,844 | 4/8/2021 | |
6.0.0-preview.2.21154.6 | 820 | 3/11/2021 | |
6.0.0-preview.1.21103.6 | 922 | 2/12/2021 | |
5.0.17 | 672,009 | 5/10/2022 | |
5.0.16 | 107,057 | 4/11/2022 | |
5.0.15 | 210,456 | 3/8/2022 | |
5.0.14 | 205,648 | 2/8/2022 | |
5.0.13 | 494,389 | 12/14/2021 | |
5.0.12 | 597,076 | 11/7/2021 | |
5.0.11 | 1,034,442 | 10/12/2021 | |
5.0.10 | 1,053,656 | 9/14/2021 | |
5.0.9 | 1,160,937 | 8/10/2021 | |
5.0.8 | 917,795 | 7/13/2021 | |
5.0.7 | 1,186,828 | 6/8/2021 | |
5.0.6 | 930,063 | 5/11/2021 | |
5.0.5 | 1,361,301 | 4/6/2021 | |
5.0.4 | 822,088 | 3/9/2021 | |
5.0.3 | 982,746 | 2/9/2021 | |
5.0.2 | 935,630 | 1/12/2021 | |
5.0.1 | 564,027 | 12/8/2020 | |
5.0.0 | 1,585,344 | 11/9/2020 | |
5.0.0-rc.2.20475.17 | 14,873 | 10/13/2020 | |
5.0.0-rc.1.20451.17 | 7,741 | 9/14/2020 | |
5.0.0-preview.8.20414.8 | 9,109 | 8/25/2020 | |
5.0.0-preview.7.20365.19 | 3,551 | 7/21/2020 | |
5.0.0-preview.6.20312.15 | 2,005 | 6/25/2020 | |
5.0.0-preview.5.20279.2 | 834 | 6/10/2020 | |
5.0.0-preview.4.20257.10 | 1,461 | 5/18/2020 | |
5.0.0-preview.3.20215.14 | 1,842 | 4/23/2020 | |
5.0.0-preview.2.20167.3 | 835 | 4/2/2020 | |
5.0.0-preview.1.20124.5 | 1,070 | 3/16/2020 | |
3.1.32 | 426,904 | 12/13/2022 | |
3.1.31 | 92,943 | 11/8/2022 | |
3.1.30 | 774,303 | 10/11/2022 | |
3.1.29 | 69,360 | 9/13/2022 | |
3.1.28 | 114,690 | 8/9/2022 | |
3.1.27 | 108,473 | 7/12/2022 | |
3.1.26 | 119,341 | 6/14/2022 | |
3.1.25 | 137,652 | 5/10/2022 | |
3.1.24 | 137,973 | 4/11/2022 | |
3.1.23 | 204,409 | 3/8/2022 | |
3.1.22 | 585,391 | 12/14/2021 | |
3.1.21 | 432,127 | 11/7/2021 | |
3.1.20 | 378,724 | 10/11/2021 | |
3.1.19 | 267,772 | 9/14/2021 | |
3.1.18 | 796,842 | 8/10/2021 | |
3.1.17 | 566,264 | 7/13/2021 | |
3.1.16 | 489,016 | 6/8/2021 | |
3.1.15 | 436,895 | 5/11/2021 | |
3.1.14 | 770,645 | 4/6/2021 | |
3.1.13 | 903,419 | 3/9/2021 | |
3.1.12 | 548,831 | 2/9/2021 | |
3.1.11 | 696,239 | 1/12/2021 | |
3.1.10 | 2,126,592 | 11/9/2020 | |
3.1.9 | 2,315,925 | 10/13/2020 | |
3.1.8 | 2,026,721 | 9/8/2020 | |
3.1.7 | 1,568,817 | 8/11/2020 | |
3.1.6 | 1,761,755 | 7/14/2020 | |
3.1.5 | 2,117,644 | 6/9/2020 | |
3.1.4 | 1,487,349 | 5/12/2020 | |
3.1.3 | 2,397,707 | 3/24/2020 | |
3.1.2 | 1,986,584 | 2/18/2020 | |
3.1.1 | 1,783,540 | 1/14/2020 | |
3.1.0 | 2,135,674 | 12/3/2019 | |
3.1.0-preview3.19555.2 | 2,231 | 11/13/2019 | |
3.1.0-preview2.19528.8 | 1,015 | 11/1/2019 | |
3.1.0-preview1.19508.20 | 1,481 | 10/15/2019 | |
3.0.3 | 108,330 | 2/18/2020 | |
3.0.2 | 57,959 | 1/14/2020 | |
3.0.0 | 2,858,169 | 9/23/2019 | |
3.0.0-rc1.19457.4 | 10,530 | 9/16/2019 | |
3.0.0-preview9.19424.4 | 5,024 | 9/4/2019 | |
3.0.0-preview8.19405.7 | 14,899 | 8/13/2019 | |
3.0.0-preview7.19365.7 | 5,757 | 7/23/2019 | |
3.0.0-preview6.19307.2 | 4,570 | 6/12/2019 | |
3.0.0-preview5-19227-01 | 13,925 | 5/6/2019 | |
3.0.0-preview4-19216-03 | 1,989 | 4/18/2019 | |
3.0.0-preview3-19153-02 | 1,450 | 3/6/2019 | |
3.0.0-preview-19075-0444 | 3,598 | 1/29/2019 | |
3.0.0-preview-18579-0056 | 3,117 | 12/3/2018 | |
2.3.0 | 2,805 | 3 months ago | |
2.2.0 | 6,556,558 | 12/3/2018 | |
2.2.0-preview3-35497 | 16,026 | 10/17/2018 | |
2.2.0-preview2-35157 | 4,129 | 9/12/2018 | |
2.2.0-preview1-35029 | 7,243 | 8/22/2018 | |
2.1.3 | 1,471,151 | 10/1/2018 | |
2.1.2 | 363,300 | 8/21/2018 | |
2.1.1 | 992,901 | 6/18/2018 | |
2.1.0 | 839,294 | 5/29/2018 | |
2.1.0-rc1-final | 20,779 | 5/6/2018 | |
2.1.0-preview2-final | 4,791 | 4/10/2018 | |
2.1.0-preview1-final | 3,743 | 2/26/2018 |