MvcIntegrationTestFramework 1.0.8

Install-Package MvcIntegrationTestFramework -Version 1.0.8
dotnet add package MvcIntegrationTestFramework --version 1.0.8
<PackageReference Include="MvcIntegrationTestFramework" Version="1.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MvcIntegrationTestFramework --version 1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MvcIntegrationTestFramework, 1.0.8"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MvcIntegrationTestFramework as a Cake Addin
#addin nuget:?package=MvcIntegrationTestFramework&version=1.0.8

// Install MvcIntegrationTestFramework as a Cake Tool
#tool nuget:?package=MvcIntegrationTestFramework&version=1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Integration test harness for ASP.Net MVC 5. Allows you to fully integration test an MVC web project without needing to host under IIS or similar. Allows access to both server state and client responses in a single assertion.

Batteries included

This fork targets MVC 5, VS2015.

Everything should just work out of the box, no need for post build steps.


In your test set-up start a new AppHost targeting the folder containing your MVC application:

	this.appHost = AppHost.Simulate("MyMvcApplication");

Then for each test flow, start a browsing session, make your calls and assert against the results:

	this.appHost.Start(browsingSession =>
		// Request the root URL
		RequestResult result = browsingSession.Get("/welcome");

		// Check the result status

		// Make assertions about the ActionResult
		var viewResult = (ViewResult)result.ActionExecutedContext.Result;
		Assert.AreEqual("Index", viewResult.ViewName);
		Assert.AreEqual("Welcome to ASP.NET MVC!", viewResult.ViewData["Message"]);

		// Or make assertions about the rendered HTML
		Assert.IsTrue(result.ResponseText.Contains("<!DOCTYPE html"));

See the MyMvcApplication.Tests project and the HomeControllerTests.cs file for more examples.

The framework injects it's own System.Web.Optimization bundle provider, which supplies blank CSS and Javascript files.

Known issues

Simple Injector

Simple Injector's [assembly: WebActivator.PostApplicationStartMethod(...)] injection can cause problems with the ASP.Net hosting enviroment. You can remove the assembly level injector and call your setup from Global.aspx to solve this.

TFS Builds

TFS Build servers can restructure your project, causing the test framework to not find the MVC project directory. To work around this, you can pass multiple potential locations for your project to the Simulate function, and the first one to be found will be used.

For example,

    appHost = AppHost.Simulate(
        "Source\\Web\\MyMvcApplication",             // Local solution location
        "a\\_PublishedWebsites\\MyMvcApplication");  // TFS build system, under ...\Agent\_work\1\a\_PublishedWebsites ...

Icon via

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.8 9,232 5/30/2018
1.0.7 5,895 7/13/2017
1.0.6 898 4/6/2017
1.0.5 552 4/6/2017
1.0.4 582 4/5/2017
1.0.3 560 4/5/2017
1.0.2 848 4/5/2017
1.0.1 686 4/4/2017
1.0.0 591 4/3/2017

Adding dll resolve-by-name flag to AppHost