MSTest — Filtered .NET Test Runner

VerifiedCaution

Run backend tests with filtered output (pass/fail test names, error messages, summary).

Sby Skills Guide Bot
TestingIntermediate
7/25/2026
Claude Code
#mstest#dotnet#test-runner#filtered-output#powershell

Recommended for

Automated summary

Runs .NET backend tests through MSTest while showing only passed/failed test names, error messages, and the summary, via a PowerShell build queue.

Strengths

  • Filtered output that cuts most of the noise compared with raw dotnet test
  • Supports MSTest filter expressions (ClassName~, Name~, FullyQualifiedName~) and selecting the test DLL
  • Handles long runs explicitly: 10-minute timeout, background execution, and an await helper that re-emits an authoritative result banner
  • Serialized through the build queue, avoiding clashes with concurrent builds

Limitations

  • Tightly coupled to one repository: Cognito project names, the .claude/skill-config/build-queue-ops.json manifest, and scripts under $HOME/.claude/scripts
  • Requires Windows PowerShell and will not work as-is in another repo without adaptation
  • Runs with --no-build, so you must compile first (e.g. via /msbuild) or results may be stale
When to use it

Use it when you need to run targeted .NET unit tests quickly and read only the essentials: failures, errors, and the summary.

When not to use it

Don't use it to deep-debug a failing test (it does not reformat or interpret output), or on a .NET project that lacks the expected build queue and scripts.

Security analysis

Caution
Quality score88/100

The skill is a test-runner wrapper and does not itself perform destructive, exfiltrating, or obfuscated actions. However, it invokes PowerShell with ExecutionPolicy Bypass, appends user arguments verbatim, and relies on local scripts that are not part of the catalog entry, making it a powerful local execution surface that merits caution rather than a clean safe rating.

Findings
  • •Uses `powershell.exe -ExecutionPolicy Bypass` to run local scripts, which weakens PowerShell execution policy for the invocation.
  • •Appends `$ARGUMENTS` verbatim to the PowerShell command, creating a potential argument-injection surface if untrusted input is supplied.
  • •Depends on external scripts under `$HOME/.claude/scripts` and repo-local ops manifest not included in the skill, so behavior depends on opaque local code.
How this analysis is made

Examples

Run all unit tests
/mstest
Run a filtered test class
/mstest -Filter "ClassName~PersonSubmissionIndexingTests"
Filtered Selenium browser tests
/mstest -TestDll "Cognito.Forms.UnitTests" -Filter "ClassName~Foo"

name: mstest description: Run backend tests with filtered output (pass/fail + errors only). Wraps test-filtered.ps1. argument-hint: [-Filter "ClassName~Foo"] [-TestDll "Cognito.Forms.UnitTests"] model: haiku allowed-tools: ["Bash"]

MSTest — Filtered .NET Test Runner

Run backend tests showing only passed/failed test names, error messages, and summary. Runs with --no-build — build first if needed. For a fast targeted compile of just the project under test, run /msbuild -Project "<relative/path/to.csproj>" before this (both stay serialized through the build queue).

Usage

  • /mstest — run all unit tests (Cognito.UnitTests — this is where ALL service/unit tests live)
  • /mstest -Filter "ClassName~MyTestClass" — run filtered tests
  • /mstest -TestDll "Cognito.Forms.UnitTests" — run Selenium/browser integration tests (NOT service tests)
  • /mstest -TestDll "Cognito.Forms.UnitTests" -Filter "ClassName~Foo" — filtered browser tests

Important: Cognito.UnitTests contains all service-level tests (EntryIndexServiceTests, PersonSubmissionIndexingTests, ShouldInvalidateIndexTests, etc.). Cognito.Forms.UnitTests is only for Selenium browser tests. When in doubt, use the default (no -TestDll flag).

Filter Syntax

MSTest filter expressions: ClassName~Foo, Name~Bar, FullyQualifiedName~Baz

Instructions

  1. Construct the command:

    powershell.exe -ExecutionPolicy Bypass -File "$HOME/.claude/scripts/build-queue.ps1" -Op mstest
    

    The mstest op is registered in this repo's ops manifest (.claude/skill-config/build-queue-ops.json — the queue's per-repo op registry), which is the authoritative source of the exec script (test-filtered.ps1). Do NOT pass -Exec — the manifest resolves it. (-Exec remains an optional override; a passed-or-manifest exec that does not exist now fails fast with a distinct exec script not found error before anything is enqueued.)

  2. If $ARGUMENTS is provided, append it verbatim to the command. The script accepts:

    • -Filter "..." — MSTest filter expression
    • -TestDll "..." — test project name without extension (default: Cognito.UnitTests)
  3. Run the command using Bash with timeout: 600000 (10 min). A test run can legitimately exceed the default 2-min Bash timeout; the higher ceiling costs nothing for fast runs because Bash returns as soon as the command exits. Do not interpret or reformat the output. The invocation prints an authoritative one-line build-queue: seq=<N> op=mstest RESULT=<PASS|FAIL|NO-TESTS-MATCHED> tests=<T> failed=<F> (result_fidelity=...) banner as its LAST stdout line — trust that line for the outcome. Do NOT cat/grep the runner script (build-queue-runner.ps1) or results/<seq>.json to disambiguate an exit_code=0. See the exit-code guidance below for the banner's next-actions. ETA note: the enqueue echo and waiting-position lines may carry advisory predictions (eta-start≈ / eta-done≈, ? when history is cold) computed from recent run durations. They are predictions, never outcomes — the authoritative outcome remains the final build-queue: ... RESULT= banner line.

  4. If the run is expected to exceed 10 minutes, run the same command with run_in_background: true instead. The build-queue: enqueued as seq=N line it returns is NOT an outcome — never end your turn or report a result on it. Follow the run to its authoritative result with the await helper (foreground Bash, timeout: 600000):

    powershell.exe -ExecutionPolicy Bypass -File "$HOME/.claude/scripts/build-queue-await.ps1" -Seq <N>
    

    It blocks until results/<seq>.json exists, re-emits the same authoritative build-queue: seq=<N> op=mstest RESULT=... banner as its LAST stdout line, and exits with the run's exit code. On its distinct await-timeout exit (124, result not yet present for seq=N) the run is still going — re-run the helper or check /build-queue-status; NEVER treat a timeout as success, and do not hand-read results/<seq>.json instead.

    Foreground-timeout recovery: if a foreground run is killed by the 10-min Bash timeout before the banner prints, recover the seq from the build-queue: enqueued as seq=N line already in the output and run the same await helper — do NOT re-enqueue the run.

Log files: <seq>.build.log vs <seq>.log

Test-run output for this op lands in ~/.claude/state/build-queue/logs/<seq>.log. But when a red run traces back to a build problem (e.g. the stale-DLL exit 4 below sends you to /msbuild), note that a build op's real transcript is that seq's <seq>.build.log (stderr: <seq>.build.err.log) — for build ops the sibling <seq>.log is the runner's own near-empty log, not the build output.

Stale-DLL trap (--no-build)

Because this skill runs --no-build, a red result can be bogus if the DLL under test is stale — e.g. the last build silently lost a DLL copy race (MSB3027 copy-lock). test-filtered.ps1 now guards against this: it emits a staleness WARN and exits 4 when the target test DLL is missing, predates its source (.cs/.csproj) files, or the last build's hygiene recorded build_fidelity: log-failure-override. (Other distinct exit codes: 1 = not in a git repo, 3 = zero test output captured, 5 = filter matched zero tests.)

On the staleness WARN / exit 4 (banner RESULT=FAIL): rebuild with /msbuild before trusting a red. A failing test against a stale DLL is not a real failure — rebuild, then re-run /mstest.

On banner RESULT=NO-TESTS-MATCHED (exit 5): the filter matched zero tests — widen the -Filter and re-run. A zero-match run is not a pass; the banner distinguishes it from a real all-pass (result_fidelity=no-tests-matched vs verified), so trust the banner rather than reading a bare exit_code.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/mstest-filtered-net-test-runner-mrzxuqhn/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/mstest-filtered-net-test-runner-mrzxuqhn' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/mstest-filtered-net-test-runner-mrzxuqhn/download' --output '.skill-downloads/mstest-filtered-net-test-runner-mrzxuqhn/SKILL.md.part' && mv '.skill-downloads/mstest-filtered-net-test-runner-mrzxuqhn/SKILL.md.part' '.skill-downloads/mstest-filtered-net-test-runner-mrzxuqhn/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/mstest-filtered-net-test-runner-mrzxuqhn/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills