Skip to content

History & Architecture

What is now Alba was originally created in the early 2010's as a mechanism to test the content negotiation features in FubuMVC, an alternative web application framework that predates ASP.NET Core. We needed to run the entire web handling stack including all the middleware and HTTP endpoints just as the application would be configured. The early scenario support in FubuMVC was a way to run HTTP requests end to end completely in memory and make declarative checks on expected HTTP behavior.

As FubuMVC wound down as a project, the scenario testing code was first extracted out into its own library called Alba, then ported to depend on an OWIN-based execution pipeline. And then again with the advent of ASP.NET Core and the deprecation of OWIN, Alba was again re-wired to use the newer HTTP abstractions from the ASP.NET Core HttpContext type. At this point, Alba is a value added wrapper around the ASP.NET Core TestServer.

The scenario testing in Alba was inspired by the testing support in the Scala PlayFramework.

When using Alba, you actually bootstrap your web application in memory using either the "older" HostBuilder model or the newer WebApplicationFactory model , then pass the root IHost of the running application to Alba's AlbaHost, which will be the entry point to using Alba in all of your integration tests.

AlbaHost is shown in the class diagram below:

AlbaHost Class Diagram

AlbaHost implements the ASP.NET Core IHost interface for convenience and familiarity. Internally it is tracking the actual IHost for your application running in memory as well as an instance of the ASP.NET Core TestServer that will actually be used to execute HTTP requests against the application in memory.