.github/skills/vstest-build-test/SKILL.md
Build, test, and validate changes in the vstest repository. Use when building vstest projects, running unit tests, smoke tests, or acceptance tests, or when deploying locally built vstest.console for manual testing.
npx skillsauth add microsoft/vstest vstest-build-testInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before building, verify the .dotnet toolchain matches the current OS. The repo bootstraps its own .NET SDK into .dotnet/.
Run this check before every first build in a session:
# Determine current OS
OS=$(uname -s) # "Linux", "Darwin" (macOS), or contains "MINGW"/"MSYS" (Windows/Git Bash)
if [ -d ".dotnet" ]; then
if [ "$OS" = "Linux" ] || [ "$OS" = "Darwin" ]; then
# On Linux/macOS the dotnet binary must be an ELF/Mach-O executable, not .exe
if [ -f ".dotnet/dotnet.exe" ] && [ ! -f ".dotnet/dotnet" ]; then
echo "MISMATCH: .dotnet contains Windows binaries but OS is $OS"
rm -rf .dotnet .packages artifacts
echo "Cleaned .dotnet, .packages, and artifacts for fresh bootstrap"
fi
else
# On Windows the dotnet binary should be dotnet.exe
if [ -f ".dotnet/dotnet" ] && [ ! -f ".dotnet/dotnet.exe" ]; then
echo "MISMATCH: .dotnet contains Linux/macOS binaries but OS is Windows"
rm -rf .dotnet .packages artifacts
echo "Cleaned .dotnet, .packages, and artifacts for fresh bootstrap"
fi
fi
fi
After cleanup (or if .dotnet doesn't exist), the build script automatically downloads the correct SDK version from global.json.
| Action | Windows | Linux / macOS |
|---|---|---|
| Restore + Build | ./build.cmd | ./build.sh |
| Restore only | ./restore.cmd | ./restore.sh |
| Build + Pack | ./build.cmd -pack | ./build.sh --pack |
| Release config | ./build.cmd -c Release -pack | ./build.sh -c Release --pack |
| Single project | ./build.cmd -project <csproj> | ./build.sh --projects <csproj> |
For projects with many cross-project dependencies (e.g., HtmlLogger, TrxLogger, vstest.console):
# Linux / macOS
./build.sh --pack
# Windows
./build.cmd -pack
This produces NuGet packages under artifacts/packages/Debug/Shipping/.
For isolated projects with few dependencies:
# Linux / macOS
./build.sh --projects <path-to-csproj>
# Windows
./build.cmd -project <path-to-csproj>
Warning: This does NOT work for projects like HtmlLogger that have many transitive dependencies. Use
--pack/-packinstead.
# Linux / macOS
./test.sh
# Windows
./test.cmd
Use -p to filter by assembly name pattern:
# Linux / macOS
./test.sh -p htmllogger # HTML logger tests
./test.sh -p trxlogger # TRX logger tests
./test.sh -p datacollector # Data collector tests
./test.sh -p smoke # Smoke tests
# Windows (-p is ambiguous in PowerShell; use -projects)
./test.cmd -projects htmllogger
./test.cmd -projects smoke
# Windows
./test.cmd -bl -c release /p:TestRunnerAdditionalArguments="'--filter TestName'" -Integration
# Linux / macOS
./test.sh -bl -c release /p:TestRunnerAdditionalArguments="'--filter TestName'" --integrationTest
After building with --pack / -pack, validate vstest.console changes by unzipping the built package:
artifacts/packages/Debug/Shipping/Microsoft.TestPlatform.<version>-dev.nupkg.nupkg files are ZIP archives)artifacts/<Configuration>/netcoreapp1.0/vstest.console.dllartifacts/<Configuration>/net46/win7-x64/vstest.console.exe| Category | Speed | What it tests | Filter |
|---|---|---|---|
| Unit tests | Fast | Individual units | ./test.sh / ./test.cmd (default) |
| Smoke tests | Slow | P0 end-to-end scenarios | -p smoke |
| Acceptance tests | Slowest | Extensive coverage | --integrationTest / -Integration flag |
docs/diagnose.mdDebugger.Launch at process entry points (testhost.exe, vstest.console.exe)development
Best practices for writing MSTest 3.x/4.x unit tests. Use when the user needs to write, improve, fix, or review MSTest tests, including modern assertions, data-driven tests, test lifecycle, and common anti-patterns. Also use when fixing test issues like swapped Assert.AreEqual arguments, incorrect assertion usage, or modernizing legacy test code. Covers MSTest.Sdk, sealed classes, Assert.Throws, DynamicData with ValueTuples, TestContext, and conditional execution.
development
Validate that commands documented in skill files actually work. Use when creating, updating, or reviewing skills to ensure all documented commands exit with code 0.
testing
Parse and analyze Visual Studio TRX test result files. Use when asked about slow tests, test durations, test frequency, flaky tests, failure analysis, or test execution patterns from TRX files.
development
Quick pragmatic review of .NET test code for anti-patterns that undermine reliability and diagnostic value. Use when asked to review tests, find test problems, check test quality, or audit tests for common mistakes. Catches assertion gaps, flakiness indicators, over-mocking, naming issues, and structural problems with actionable fixes. Use for periodic test code reviews and PR feedback. For a deep formal audit based on academic test smell taxonomy, use exp-test-smell-detection instead. Works with MSTest, xUnit, NUnit, and TUnit.