'Differences between Microsoft.AspNetCore.Mvc.Testing and Microsoft.AspNetCore.TestHost packages

I have used several times the package Microsoft.AspNetCore.TestHost to host Asp.Net Core Web API applications in my integration test.

With Asp.Net Core 2.1 the package Microsoft.AspNetCore.Mvc.Testing was released. But Mvc.Testing has a dependency to TestHost.

I was wondering which features Mvc.Testing package is offering on top of the TestHost package. Specially when it is used in functional testing to host an API.



Solution 1:[1]

The Microsoft.AspNetCore.TestHost package consists of a set of types (including TestServer) to enable hosting your application in-memory for testing purposes. The Microsoft.AspNetCore.Mvc.Testing package provides infrastructure to enable functional testing of applications (including the TestServer) using the WebApplicationFactory class.

Check out the docs for more info about integration/functional testing: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Henk Mollema