Microsoft.AspNetCore.Mvc.Testing 11.0.0

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.

No packages depend on Microsoft.AspNetCore.Mvc.Testing.

Version Downloads Last updated
11.0.0 3 11/12/2026
11.0.0-rc.3.26522.148 3 11/11/2026
11.0.0-rc.2.26504.105 4 10/30/2026
11.0.0-rc.1.26425.128 10 09/11/2026
11.0.0-preview.7.26381.103 11 09/02/2026
11.0.0-preview.6.26359.118 15 07/17/2026
11.0.0-preview.5.26302.115 16 06/12/2026
11.0.0-preview.4.26230.115 17 05/13/2026
11.0.0-preview.3.26207.106 15 06/24/2026
11.0.0-preview.2.26159.112 15 04/06/2026
11.0.0-preview.1.26104.118 16 02/24/2026
10.0.15 1 11/24/2026
10.0.14 4 11/07/2026
10.0.13 2 11/09/2026
10.0.12 8 09/18/2026
10.0.11 10 08/19/2026
10.0.10 15 07/20/2026
10.0.9 16 06/24/2026
10.0.8 19 05/13/2026
10.0.7 13 05/30/2026
10.0.6 12 06/12/2026
10.0.5 16 04/05/2026
10.0.4 18 04/05/2026
10.0.3 18 03/06/2026
10.0.2 17 02/22/2026
10.0.1 17 12/21/2025
10.0.0 18 12/21/2025
10.0.0-rc.2.25502.107 19 10/16/2025
10.0.0-rc.1.25451.107 15 09/23/2025
10.0.0-preview.7.25380.108 15 08/13/2025
10.0.0-preview.6.25358.103 21 07/20/2025
10.0.0-preview.5.25277.114 15 08/08/2025
10.0.0-preview.4.25258.110 14 06/24/2026
10.0.0-preview.3.25172.1 15 04/11/2025
10.0.0-preview.2.25164.1 20 06/30/2026
10.0.0-preview.1.25120.3 17 02/26/2025
9.0.23 1 11/21/2026
9.0.22 3 11/11/2026
9.0.21 2 11/16/2026
9.0.20 10 09/11/2026
9.0.19 15 08/19/2026
9.0.18 16 07/15/2026
9.0.17 17 06/24/2026
9.0.16 15 06/24/2026
9.0.15 10 06/24/2026
9.0.14 22 06/24/2026
9.0.13 10 06/24/2026
9.0.12 14 06/24/2026
9.0.11 14 06/24/2026
9.0.10 14 06/24/2026
9.0.9 17 06/24/2026
9.0.8 14 06/24/2026
9.0.7 14 06/24/2026
9.0.6 13 06/24/2026
9.0.5 12 06/24/2026
9.0.4 17 04/11/2025
9.0.3 21 03/16/2025
9.0.2 19 02/15/2025
9.0.1 17 02/15/2025
9.0.0 20 12/12/2024
9.0.0-rc.2.24474.3 15 06/29/2026
9.0.0-rc.1.24452.1 21 10/08/2024
9.0.0-preview.7.24406.2 23 06/24/2026
9.0.0-preview.6.24328.4 16 08/07/2024
9.0.0-preview.5.24306.11 19 06/24/2026
9.0.0-preview.4.24267.6 15 06/02/2024
9.0.0-preview.3.24172.13 9 06/24/2026
9.0.0-preview.2.24128.4 14 06/24/2026
9.0.0-preview.1.24081.5 15 07/15/2024
8.0.34 4 11/21/2026
8.0.33 1 11/20/2026
8.0.32 2 11/04/2026
8.0.31 7 09/16/2026
8.0.30 15 08/19/2026
8.0.29 11 07/16/2026
8.0.28 16 06/24/2026
8.0.27 10 06/24/2026
8.0.26 14 06/24/2026
8.0.25 18 06/24/2026
8.0.24 14 06/24/2026
8.0.23 9 06/24/2026
8.0.22 16 06/24/2026
8.0.21 16 06/24/2026
8.0.20 16 06/24/2026
8.0.19 13 06/24/2026
8.0.18 13 08/18/2025
8.0.17 16 06/24/2026
8.0.16 17 06/16/2025
8.0.15 12 06/24/2026
8.0.14 16 06/24/2026
8.0.13 12 06/24/2026
8.0.12 17 06/24/2026
8.0.11 18 06/24/2026
8.0.10 18 06/24/2026
8.0.8 12 06/24/2026
8.0.7 12 06/24/2026
8.0.6 21 06/03/2024
8.0.5 12 06/24/2026
8.0.4 12 06/24/2026
8.0.3 20 03/18/2024
8.0.2 15 06/02/2024
8.0.1 14 07/15/2024
8.0.0 26 12/12/2023
8.0.0-rc.2.23480.2 14 10/11/2024
8.0.0-rc.1.23421.29 16 06/24/2026
8.0.0-preview.7.23375.9 15 10/15/2024
8.0.0-preview.6.23329.11 13 12/04/2024
8.0.0-preview.5.23302.2 18 11/09/2024
8.0.0-preview.4.23260.4 20 12/02/2024
8.0.0-preview.3.23177.8 12 06/24/2026
8.0.0-preview.2.23153.2 17 06/24/2026
8.0.0-preview.1.23112.2 15 08/31/2024
7.0.20 13 06/24/2026
7.0.19 14 06/24/2026
7.0.18 16 06/24/2026
7.0.17 16 06/24/2026
7.0.16 17 06/24/2026
7.0.15 14 06/24/2026
7.0.14 33 01/17/2024
7.0.13 12 02/22/2024
7.0.12 17 06/24/2026
7.0.11 15 10/09/2024
7.0.10 19 06/24/2026
7.0.9 14 03/05/2024
7.0.8 10 10/21/2024
7.0.7 16 06/24/2026
7.0.5 14 06/24/2026
7.0.4 16 03/28/2024
7.0.3 15 08/28/2024
7.0.2 23 11/16/2024
7.0.1 14 11/21/2024
7.0.0 17 10/09/2025
7.0.0-rc.2.22476.2 17 03/07/2024
7.0.0-rc.1.22427.2 24 04/22/2024
7.0.0-preview.7.22376.6 11 05/06/2025
7.0.0-preview.6.22330.3 15 06/24/2026
7.0.0-preview.5.22303.8 15 05/24/2025
7.0.0-preview.4.22251.1 10 01/14/2024
7.0.0-preview.3.22178.4 13 10/03/2024
7.0.0-preview.2.22153.2 18 02/18/2024
7.0.0-preview.1.22109.13 18 08/26/2024
6.0.36 10 06/24/2026
6.0.35 13 06/24/2026
6.0.33 17 06/24/2026
6.0.32 19 06/24/2026
6.0.31 16 06/24/2026
6.0.30 19 06/24/2026
6.0.29 24 06/24/2026
6.0.28 16 06/24/2026
6.0.27 15 06/24/2026
6.0.26 15 06/24/2026
6.0.25 16 12/12/2023
6.0.24 16 10/10/2024
6.0.23 15 10/10/2024
6.0.22 14 06/24/2026
6.0.21 18 02/26/2024
6.0.20 18 06/24/2026
6.0.19 18 04/08/2024
6.0.18 17 11/15/2025
6.0.16 18 10/22/2024
6.0.15 16 02/13/2024
6.0.14 17 12/16/2024
6.0.13 24 11/10/2024
6.0.12 20 01/25/2024
6.0.11 17 07/17/2025
6.0.10 16 11/29/2024
6.0.9 23 02/29/2024
6.0.8 16 06/23/2025
6.0.7 17 04/08/2025
6.0.6 19 06/16/2025
6.0.5 20 04/29/2024
6.0.4 13 06/24/2026
6.0.3 9 10/31/2024
6.0.2 18 03/05/2024
6.0.1 14 11/16/2025
6.0.0 19 11/22/2024
6.0.0-rc.2.21480.10 18 04/11/2025
6.0.0-rc.1.21452.15 16 01/02/2024
6.0.0-preview.7.21378.6 15 02/21/2025
6.0.0-preview.6.21355.2 14 06/24/2026
6.0.0-preview.5.21301.17 12 03/13/2024
6.0.0-preview.4.21253.5 18 06/24/2026
6.0.0-preview.3.21201.13 15 09/01/2024
6.0.0-preview.2.21154.6 17 11/05/2024
6.0.0-preview.1.21103.6 18 02/28/2025
5.0.17 20 02/29/2024
5.0.16 21 01/27/2024
5.0.15 18 06/24/2026
5.0.14 12 07/12/2024
5.0.13 13 01/11/2025
5.0.12 27 01/23/2024
5.0.11 17 06/14/2024
5.0.10 13 01/16/2025
5.0.9 13 11/08/2025
5.0.8 17 02/11/2025
5.0.7 18 03/29/2025
5.0.6 36 02/21/2023
5.0.5 21 02/07/2024
5.0.4 15 06/06/2024
5.0.3 14 10/11/2024
5.0.2 15 06/06/2024
5.0.1 14 02/26/2025
5.0.0 387 12/11/2023
5.0.0-rc.2.20475.17 13 04/25/2025
5.0.0-rc.1.20451.17 10 12/30/2024
5.0.0-preview.8.20414.8 16 10/04/2024
5.0.0-preview.7.20365.19 13 04/01/2024
5.0.0-preview.6.20312.15 16 02/19/2024
5.0.0-preview.5.20279.2 14 12/17/2023
5.0.0-preview.4.20257.10 13 06/24/2026
5.0.0-preview.3.20215.14 11 06/24/2026
5.0.0-preview.2.20167.3 16 08/27/2024
5.0.0-preview.1.20124.5 14 08/14/2024
3.1.32 17 06/24/2026
3.1.31 20 03/29/2024
3.1.30 18 08/13/2024
3.1.29 16 10/13/2024
3.1.28 15 06/03/2025
3.1.27 15 06/24/2026
3.1.26 15 11/10/2024
3.1.25 16 06/24/2026
3.1.24 19 05/24/2024
3.1.23 15 10/09/2024
3.1.22 16 03/04/2024
3.1.21 17 09/12/2024
3.1.20 11 06/24/2026
3.1.19 13 07/25/2024
3.1.18 18 05/30/2024
3.1.17 15 08/24/2024
3.1.16 14 11/24/2024
3.1.15 16 03/03/2025
3.1.14 19 12/04/2024
3.1.13 14 06/24/2026
3.1.12 13 08/31/2024
3.1.11 13 10/01/2024
3.1.10 14 02/20/2024
3.1.9 19 07/06/2024
3.1.8 17 06/01/2025
3.1.7 18 06/24/2026
3.1.6 12 06/24/2026
3.1.5 15 07/29/2024
3.1.4 13 03/12/2025
3.1.3 16 06/15/2025
3.1.2 14 04/18/2025
3.1.1 22 04/17/2022
3.1.0 21 06/24/2026
3.1.0-preview3.19555.2 16 08/12/2024
3.1.0-preview2.19528.8 15 09/30/2024
3.1.0-preview1.19508.20 13 04/03/2025
3.0.3 14 06/24/2026
3.0.2 17 06/24/2026
3.0.0 13 11/01/2024
3.0.0-rc1.19457.4 19 06/24/2026
3.0.0-preview9.19424.4 11 05/29/2024
3.0.0-preview8.19405.7 15 04/29/2024
3.0.0-preview7.19365.7 13 02/29/2024
3.0.0-preview6.19307.2 19 06/12/2024
3.0.0-preview5-19227-01 12 06/23/2024
3.0.0-preview4-19216-03 18 11/20/2024
3.0.0-preview3-19153-02 13 10/29/2024
3.0.0-preview-19075-0444 21 06/28/2026
3.0.0-preview-18579-0056 12 01/03/2025
2.3.14 1 11/19/2026
2.3.13 11 09/11/2026
2.3.12 12 08/19/2026
2.3.11 17 06/24/2026
2.3.10 13 06/24/2026
2.3.9 16 06/24/2026
2.3.8 11 06/24/2026
2.3.0 17 06/24/2026
2.2.0 15 06/24/2026
2.2.0-preview3-35497 19 06/24/2026
2.2.0-preview2-35157 13 03/23/2025
2.2.0-preview1-35029 13 06/26/2026
2.1.3 11 09/20/2024
2.1.2 17 10/29/2025
2.1.1 13 04/14/2024
2.1.0 19 03/25/2024
2.1.0-rc1-final 17 06/17/2025
2.1.0-preview2-final 11 02/08/2024
2.1.0-preview1-final 16 07/04/2024