Microsoft.AspNetCore.Mvc.Testing 10.0.0-preview.2.25164.1

Prefix Reserved
This is a prerelease version of Microsoft.AspNetCore.Mvc.Testing.
dotnet add package Microsoft.AspNetCore.Mvc.Testing --version 10.0.0-preview.2.25164.1
                    
NuGet\Install-Package Microsoft.AspNetCore.Mvc.Testing -Version 10.0.0-preview.2.25164.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0-preview.2.25164.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0-preview.2.25164.1" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.AspNetCore.Mvc.Testing --version 10.0.0-preview.2.25164.1
                    
#r "nuget: Microsoft.AspNetCore.Mvc.Testing, 10.0.0-preview.2.25164.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Microsoft.AspNetCore.Mvc.Testing&version=10.0.0-preview.2.25164.1&prerelease
                    
Install Microsoft.AspNetCore.Mvc.Testing as a Cake Addin
#tool nuget:?package=Microsoft.AspNetCore.Mvc.Testing&version=10.0.0-preview.2.25164.1&prerelease
                    
Install Microsoft.AspNetCore.Mvc.Testing as a Cake Tool

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's bin 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 with TestServer

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:

  1. Specify the Web SDK in the test project file (<Project Sdk="Microsoft.NET.Sdk.Web">).
  2. Add references to the following packages:
    • xunit
    • xunit.runner.visualstudio
    • Microsoft.NET.Test.Sdk
  3. 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 Compatible and additional computed target framework versions.
.NET net10.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 (285)

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 910 3/18/2025
10.0.0-preview.1.25120.3 2,399 2/25/2025
9.0.3 311,974 3/11/2025
9.0.2 697,020 2/11/2025
9.0.1 827,090 1/14/2025
9.0.0 1,667,254 11/12/2024
9.0.0-rc.2.24474.3 36,521 10/8/2024
9.0.0-rc.1.24452.1 18,489 9/10/2024
9.0.0-preview.7.24406.2 7,010 8/13/2024
9.0.0-preview.6.24328.4 10,728 7/9/2024
9.0.0-preview.5.24306.11 3,221 6/11/2024
9.0.0-preview.4.24267.6 2,208 5/21/2024
9.0.0-preview.3.24172.13 69,663 4/11/2024
9.0.0-preview.2.24128.4 3,297 3/12/2024
9.0.0-preview.1.24081.5 23,875 2/13/2024
8.0.14 238,884 3/11/2025
8.0.13 701,664 2/11/2025
8.0.12 912,379 1/14/2025
8.0.11 2,890,143 11/12/2024
8.0.10 4,347,806 10/8/2024
8.0.8 5,421,767 8/13/2024
8.0.7 3,892,003 7/9/2024
8.0.6 3,543,682 5/28/2024
8.0.5 1,599,729 5/14/2024
8.0.4 3,894,960 4/9/2024
8.0.3 2,772,035 3/12/2024
8.0.2 2,741,237 2/13/2024
8.0.1 3,130,607 1/9/2024
8.0.0 4,120,074 11/14/2023
8.0.0-rc.2.23480.2 56,602 10/10/2023
8.0.0-rc.1.23421.29 50,090 9/12/2023
8.0.0-preview.7.23375.9 10,365 8/8/2023
8.0.0-preview.6.23329.11 27,551 7/11/2023
8.0.0-preview.5.23302.2 12,671 6/13/2023
8.0.0-preview.4.23260.4 225,507 5/16/2023
8.0.0-preview.3.23177.8 3,245 4/11/2023
8.0.0-preview.2.23153.2 2,008 3/14/2023
8.0.0-preview.1.23112.2 40,920 2/21/2023
7.0.20 362,736 5/28/2024
7.0.19 61,079 5/14/2024
7.0.18 163,817 4/9/2024
7.0.17 332,634 3/12/2024
7.0.16 355,710 2/13/2024
7.0.15 522,658 1/9/2024
7.0.14 902,286 11/14/2023
7.0.13 1,590,501 10/24/2023
7.0.12 688,164 10/10/2023
7.0.11 2,450,662 9/12/2023
7.0.10 1,346,665 8/8/2023
7.0.9 1,188,580 7/11/2023
7.0.8 866,778 6/22/2023
7.0.7 438,422 6/13/2023
7.0.5 2,769,939 4/11/2023
7.0.4 1,595,595 3/14/2023
7.0.3 1,427,171 2/14/2023
7.0.2 1,458,883 1/10/2023
7.0.1 833,408 12/13/2022
7.0.0 2,492,404 11/7/2022
7.0.0-rc.2.22476.2 65,876 10/11/2022
7.0.0-rc.1.22427.2 21,570 9/14/2022
7.0.0-preview.7.22376.6 7,601 8/9/2022
7.0.0-preview.6.22330.3 2,411 7/12/2022
7.0.0-preview.5.22303.8 9,289 6/14/2022
7.0.0-preview.4.22251.1 2,073 5/10/2022
7.0.0-preview.3.22178.4 1,211 4/13/2022
7.0.0-preview.2.22153.2 971 3/14/2022
7.0.0-preview.1.22109.13 4,998 2/17/2022
6.0.36 423,671 11/12/2024
6.0.35 165,630 10/8/2024
6.0.33 689,152 8/13/2024
6.0.32 250,280 7/9/2024
6.0.31 391,472 5/28/2024
6.0.30 138,078 5/14/2024
6.0.29 604,659 4/9/2024
6.0.28 362,049 3/12/2024
6.0.27 552,414 2/13/2024
6.0.26 815,504 1/9/2024
6.0.25 1,447,441 11/14/2023
6.0.24 787,505 10/24/2023
6.0.23 527,655 10/10/2023
6.0.22 863,141 9/12/2023
6.0.21 1,234,609 8/8/2023
6.0.20 1,132,686 7/11/2023
6.0.19 693,861 6/22/2023
6.0.18 454,240 6/13/2023
6.0.16 2,355,070 4/11/2023
6.0.15 1,265,066 3/14/2023
6.0.14 1,635,209 2/14/2023
6.0.13 2,123,712 1/10/2023
6.0.12 2,393,092 12/13/2022
6.0.11 2,625,310 11/7/2022
6.0.10 4,024,055 10/11/2022
6.0.9 3,076,005 9/13/2022
6.0.8 3,915,142 8/9/2022
6.0.7 3,337,625 7/12/2022
6.0.6 2,449,912 6/14/2022
6.0.5 3,071,441 5/10/2022
6.0.4 2,808,304 4/11/2022
6.0.3 3,053,308 3/8/2022
6.0.2 2,944,799 2/8/2022
6.0.1 4,300,946 12/14/2021
6.0.0 4,795,620 11/8/2021
6.0.0-rc.2.21480.10 201,259 10/12/2021
6.0.0-rc.1.21452.15 171,078 9/14/2021
6.0.0-preview.7.21378.6 7,313 8/10/2021
6.0.0-preview.6.21355.2 4,133 7/14/2021
6.0.0-preview.5.21301.17 3,067 6/15/2021
6.0.0-preview.4.21253.5 2,505 5/24/2021
6.0.0-preview.3.21201.13 2,838 4/8/2021
6.0.0-preview.2.21154.6 817 3/11/2021 6.0.0-preview.2.21154.6 is deprecated because it is no longer maintained.
6.0.0-preview.1.21103.6 916 2/12/2021 6.0.0-preview.1.21103.6 is deprecated because it is no longer maintained.
5.0.17 670,023 5/10/2022 5.0.17 is deprecated because it is no longer maintained.
5.0.16 106,803 4/11/2022 5.0.16 is deprecated because it is no longer maintained.
5.0.15 210,200 3/8/2022 5.0.15 is deprecated because it is no longer maintained.
5.0.14 205,286 2/8/2022 5.0.14 is deprecated because it is no longer maintained.
5.0.13 493,782 12/14/2021 5.0.13 is deprecated because it is no longer maintained.
5.0.12 596,233 11/7/2021 5.0.12 is deprecated because it is no longer maintained.
5.0.11 1,033,848 10/12/2021 5.0.11 is deprecated because it is no longer maintained.
5.0.10 1,052,703 9/14/2021 5.0.10 is deprecated because it is no longer maintained.
5.0.9 1,160,324 8/10/2021 5.0.9 is deprecated because it is no longer maintained.
5.0.8 917,054 7/13/2021 5.0.8 is deprecated because it is no longer maintained.
5.0.7 1,186,104 6/8/2021 5.0.7 is deprecated because it is no longer maintained.
5.0.6 929,526 5/11/2021 5.0.6 is deprecated because it is no longer maintained.
5.0.5 1,360,379 4/6/2021 5.0.5 is deprecated because it is no longer maintained.
5.0.4 821,603 3/9/2021 5.0.4 is deprecated because it is no longer maintained.
5.0.3 982,476 2/9/2021 5.0.3 is deprecated because it is no longer maintained.
5.0.2 935,296 1/12/2021 5.0.2 is deprecated because it is no longer maintained.
5.0.1 563,810 12/8/2020 5.0.1 is deprecated because it is no longer maintained.
5.0.0 1,580,645 11/9/2020 5.0.0 is deprecated because it is no longer maintained.
5.0.0-rc.2.20475.17 14,867 10/13/2020 5.0.0-rc.2.20475.17 is deprecated because it is no longer maintained.
5.0.0-rc.1.20451.17 7,734 9/14/2020 5.0.0-rc.1.20451.17 is deprecated because it is no longer maintained.
5.0.0-preview.8.20414.8 9,105 8/25/2020 5.0.0-preview.8.20414.8 is deprecated because it is no longer maintained.
5.0.0-preview.7.20365.19 3,546 7/21/2020 5.0.0-preview.7.20365.19 is deprecated because it is no longer maintained.
5.0.0-preview.6.20312.15 2,002 6/25/2020 5.0.0-preview.6.20312.15 is deprecated because it is no longer maintained.
5.0.0-preview.5.20279.2 828 6/10/2020 5.0.0-preview.5.20279.2 is deprecated because it is no longer maintained.
5.0.0-preview.4.20257.10 1,458 5/18/2020 5.0.0-preview.4.20257.10 is deprecated because it is no longer maintained.
5.0.0-preview.3.20215.14 1,837 4/23/2020 5.0.0-preview.3.20215.14 is deprecated because it is no longer maintained.
5.0.0-preview.2.20167.3 832 4/2/2020 5.0.0-preview.2.20167.3 is deprecated because it is no longer maintained.
5.0.0-preview.1.20124.5 1,064 3/16/2020 5.0.0-preview.1.20124.5 is deprecated because it is no longer maintained.
3.1.32 424,343 12/13/2022
3.1.31 92,580 11/8/2022
3.1.30 773,721 10/11/2022
3.1.29 69,142 9/13/2022
3.1.28 114,496 8/9/2022
3.1.27 108,322 7/12/2022
3.1.26 118,898 6/14/2022
3.1.25 137,302 5/10/2022
3.1.24 137,424 4/11/2022
3.1.23 204,192 3/8/2022
3.1.22 584,275 12/14/2021
3.1.21 431,681 11/7/2021
3.1.20 377,726 10/11/2021
3.1.19 267,458 9/14/2021
3.1.18 796,269 8/10/2021
3.1.17 565,999 7/13/2021
3.1.16 488,583 6/8/2021
3.1.15 436,549 5/11/2021
3.1.14 769,791 4/6/2021
3.1.13 902,753 3/9/2021
3.1.12 548,495 2/9/2021
3.1.11 695,187 1/12/2021
3.1.10 2,124,427 11/9/2020
3.1.9 2,314,784 10/13/2020
3.1.8 2,025,097 9/8/2020
3.1.7 1,567,557 8/11/2020
3.1.6 1,760,611 7/14/2020
3.1.5 2,116,371 6/9/2020
3.1.4 1,486,234 5/12/2020
3.1.3 2,395,843 3/24/2020
3.1.2 1,985,272 2/18/2020
3.1.1 1,782,077 1/14/2020
3.1.0 2,134,434 12/3/2019
3.1.0-preview3.19555.2 2,229 11/13/2019 3.1.0-preview3.19555.2 is deprecated because it is no longer maintained.
3.1.0-preview2.19528.8 1,012 11/1/2019 3.1.0-preview2.19528.8 is deprecated because it is no longer maintained.
3.1.0-preview1.19508.20 1,477 10/15/2019 3.1.0-preview1.19508.20 is deprecated because it is no longer maintained.
3.0.3 108,201 2/18/2020 3.0.3 is deprecated because it is no longer maintained.
3.0.2 57,879 1/14/2020 3.0.2 is deprecated because it is no longer maintained.
3.0.0 2,853,574 9/23/2019 3.0.0 is deprecated because it is no longer maintained.
3.0.0-rc1.19457.4 10,521 9/16/2019 3.0.0-rc1.19457.4 is deprecated because it is no longer maintained.
3.0.0-preview9.19424.4 5,021 9/4/2019 3.0.0-preview9.19424.4 is deprecated because it is no longer maintained.
3.0.0-preview8.19405.7 14,870 8/13/2019 3.0.0-preview8.19405.7 is deprecated because it is no longer maintained.
3.0.0-preview7.19365.7 5,753 7/23/2019 3.0.0-preview7.19365.7 is deprecated because it is no longer maintained.
3.0.0-preview6.19307.2 4,566 6/12/2019 3.0.0-preview6.19307.2 is deprecated because it is no longer maintained.
3.0.0-preview5-19227-01 13,897 5/6/2019 3.0.0-preview5-19227-01 is deprecated because it is no longer maintained.
3.0.0-preview4-19216-03 1,986 4/18/2019 3.0.0-preview4-19216-03 is deprecated because it is no longer maintained.
3.0.0-preview3-19153-02 1,447 3/6/2019 3.0.0-preview3-19153-02 is deprecated because it is no longer maintained.
3.0.0-preview-19075-0444 3,593 1/29/2019 3.0.0-preview-19075-0444 is deprecated because it is no longer maintained.
3.0.0-preview-18579-0056 3,113 12/3/2018 3.0.0-preview-18579-0056 is deprecated because it is no longer maintained.
2.3.0 2,422 1/14/2025
2.2.0 6,546,235 12/3/2018 2.2.0 is deprecated because it is no longer maintained.
2.2.0-preview3-35497 16,014 10/17/2018 2.2.0-preview3-35497 is deprecated because it is no longer maintained.
2.2.0-preview2-35157 4,125 9/12/2018 2.2.0-preview2-35157 is deprecated because it is no longer maintained.
2.2.0-preview1-35029 7,238 8/22/2018 2.2.0-preview1-35029 is deprecated because it is no longer maintained.
2.1.3 1,469,680 10/1/2018
2.1.2 363,249 8/21/2018
2.1.1 992,553 6/18/2018
2.1.0 837,010 5/29/2018
2.1.0-rc1-final 20,775 5/6/2018 2.1.0-rc1-final is deprecated because it is no longer maintained.
2.1.0-preview2-final 4,784 4/10/2018 2.1.0-preview2-final is deprecated because it is no longer maintained.
2.1.0-preview1-final 3,741 2/26/2018 2.1.0-preview1-final is deprecated because it is no longer maintained.