vstest-build-test

Build, test, and validate vstest repository changes across Windows, Linux, and macOS.

1.2k|337|Updated Oct 13, 2022
One-click install
npx skills add https://github.com/dotnet/dotnet --skill vstest-build-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vstest-build-test
Source: https://github.com/dotnet/dotnet/tree/main/src/vstest/.github/skills/vstest-build-test
Command: npx skills add https://github.com/dotnet/dotnet --skill vstest-build-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building and testing the vstest repository involves platform-specific scripts, a self-bootstrapped .NET SDK, and subtle pitfalls like OS/toolchain mismatches and DOTNET_ROOT misconfiguration that cause confusing failures. This Skill guides you through the correct build, test, and validation workflow so changes are verified reliably.

Core Features & Use Cases

  • Environment Verification: Detects mismatches between the current OS and the bootstrapped .dotnet toolchain, cleaning and re-bootstrapping when needed.
  • Build Orchestration: Covers full builds with --pack, single-project builds, restore-only runs, and Release configuration packaging.
  • Test Execution: Runs unit, smoke, integration, performance, and compatibility test suites with correct per-platform switches and name filters.
  • Manual Validation: Explains how to unzip the built Microsoft.TestPlatform NuGet package and run a locally built vstest.console against test projects.
  • Use Case: After modifying the HtmlLogger, use this Skill to run ./build.sh --pack, execute the HtmlLogger unit tests via a project glob, and validate the produced vstest.console artifact.

Quick Start

Build the vstest repository and run the unit tests for my changes, then show me how to validate the locally built vstest.console.

Frequently Asked Questions about vstest-build-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build the vstest repository from source?

Run ./build.sh on Linux/macOS or ./build.cmd on Windows to restore and build. Add --pack or -pack to produce NuGet packages under artifacts/packages/Debug/Shipping/, which is recommended for projects with many cross-project dependencies.

How do I run vstest unit tests for a specific project?

Pass a resolvable path or glob to the -projects/--projects parameter, such as ./test.sh --projects "test*HtmlLogger*/*.csproj". A bare project nickname fails because the value goes through Resolve-Path.

Why do vstest tests fail with 'You must install or update .NET to run this application'?

Test executables target the repo's preview TFM and resolve the runtime from DOTNET_ROOT, which test.cmd does not set on Windows. Set $env:DOTNET_ROOT to the repo's .dotnet directory before running tests.

How do I run smoke or integration tests in vstest?

On Windows use ./test.cmd -smokeTest or -integrationTest; these switches are handled by eng/build.ps1. On Linux/macOS only --integrationTest and --performanceTest exist, and smoke tests are included in the integration run.

How do I filter vstest tests by name?

On Windows use ./test.cmd -filter "FullyQualifiedName~MyScenario". On Linux/macOS pass it as an MSBuild property: ./test.sh --integrationTest --property:'TestRunnerAdditionalArguments=--filter "FullyQualifiedName~MyScenario"'.

Why does the vstest build fail after switching operating systems?

The repo bootstraps an OS-specific .NET SDK into .dotnet/, so binaries from another OS cause load failures. Delete .dotnet, .packages, and artifacts, then rebuild so the correct SDK is downloaded from global.json.