Meziantou.AspNetCore.Testing 0.1.2

Prefix Reserved
dotnet add package Meziantou.AspNetCore.Testing --version 0.1.2
                    
NuGet\Install-Package Meziantou.AspNetCore.Testing -Version 0.1.2
                    
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="Meziantou.AspNetCore.Testing" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.AspNetCore.Testing" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.AspNetCore.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 Meziantou.AspNetCore.Testing --version 0.1.2
                    
#r "nuget: Meziantou.AspNetCore.Testing, 0.1.2"
                    
#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.
#:package Meziantou.AspNetCore.Testing@0.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.AspNetCore.Testing&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.AspNetCore.Testing&version=0.1.2
                    
Install as a Cake Tool

Meziantou.AspNetCore.Testing

Tests of Blazor components and of ASP.NET Core applications (MVC, Razor Pages, Blazor, minimal APIs...) in a browser engine written in .NET (Meziantou.Framework.WebPlatform): the pages have a real DOM, the CSS applies, the scripts run, and the user input (mouse, keyboard, touch) goes through the hit testing of the page. Compare the HTML, the accessibility tree and the screenshots with snapshots.

Render a Blazor component alone with ComponentTestHost (in the Meziantou.AspNetCore.Testing.Components namespace):

await using var host = new ComponentTestHost();
var counter = await host.RenderAsync<Counter>(parameters => parameters.Add(c => c.IncrementAmount, 2));

// A real click: the pointer moves to the center of the button, the hit testing finds the button
await counter.Find("button").ClickAsync();
await counter.GetByRole("button", "Click me").ClickAsync();

Assert.Equal("Current count: 4", counter.GetByRole("status").TextContent);
Assert.Equal("""
    <p role="status">Current count: 4</p>
    <button class="btn">Click me</button>
    """, counter.Markup);

Open the pages of an application, in memory with TestServer or on a server, with WebAppBrowser:

// The application runs in memory: Program is the entry point of the application under test
await using var factory = new WebApplicationFactory<Program>();
await using var browser = WebAppBrowser.Create(factory.Server);
var page = await browser.OpenAsync("/");
await Expect(page).ToHaveTitleAsync("Home");

// Follow a link, fill a form and submit it: the POST, the redirect and the cookie go through the application
await page.GetByRole("link", "Sign in").ClickAsync();
await page.GetByLabel("Name").FillAsync("Ada");
await page.GetByRole("button", "Sign in").ClickAsync();

await Expect(page).ToHaveUrlAsync("/profile");
await Expect(page.Locator("#greeting")).ToHaveTextAsync("Hello Ada");

As in Playwright, GetByRole, GetByLabel, GetByText and the other locators find their element again each time they are used, the actions wait until the element is visible, stable, enabled and not covered, and the assertions of Expectations.Expect retry until they pass. The elements are the DOM elements of Meziantou.Framework.WebPlatform.Dom.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.2 0 11/15/2026
0.1.1 40 11/14/2026
0.1.0 50 11/14/2026