liveBook · Manning

Test-runner adapter

As explained in ASP.NET Core in Action, 3e

A test runner adapter is a component that enables a test runner to discover and execute tests written for a particular test framework.

A test runner adapter connects a testing framework to test execution tools. It lets dotnet test and Visual Studio discover and execute tests written with frameworks such as xUnit, NUnit, Fixie, or MSTest. section 35.1

A test project typically includes these pieces:

  • The .NET Test SDK provides the underlying test execution support. section 35.1
  • A test framework, such as xUnit, defines tests and assertions. section 35.1
  • The framework-specific adapter hooks the tests into dotnet test and Visual Studio Test Explorer. section 35.1

An xUnit test project

Creating an xUnit test project with dotnet new xunit adds Microsoft.NET.Test.Sdk, xunit, and xunit.runner.visualstudio NuGet packages. After adding tests, run dotnet test in the project directory or use Test Explorer in Visual Studio; both approaches execute the project’s tests. section 35.7

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines the adapter’s role and package placement but does not explain its internal discovery or execution protocol.
Examples
Uses xUnit with xunit.runner.visualstudio, dotnet test, and Visual Studio Test Explorer.
What it assumes
Assumes a .NET test project and testing framework, while identifying the required SDK, framework, and adapter dependencies.
What you can do after
Operate test execution by adding the appropriate adapter package and running tests through dotnet test or Visual Studio.
How it connects
Connects the .NET Test SDK, unit testing frameworks, test projects, dotnet test, and Visual Studio Test Explorer.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.