VSTest Runner
The VSTest Runner executes automated tests built with Visual Studio test frameworks and generates structured test reports for analysis and quality validation.
When to Use
Use the VSTest Runner when you need to:
- Run unit, integration, or regression tests as part of a build.
- Enforce quality gates based on test results.
- Generate test reports for auditing, troubleshooting, or compliance.
- Validate application stability before releases.
Parameters
| Parameter | Description |
|---|---|
| Step Name | Optional step name. Defaults to the runner name if not specified. |
| Working Directory | Directory where the test process runs. |
| Test Assembly | Path to the test assembly to run. |
| Reports Folder | Folder path where test reports are saved. |
| Report Name | Name of the test report file (without extension). |
| Fail Criterion | Defines failure conditions — test fails if errors exceed a specified percentage or count. |
| Arguments | Additional arguments to pass to VSTest. |
Typical Use Cases
Common scenarios for using the VSTest Runner include:
- CI test validation.
- Code coverage and quality verification.
- Regression testing before deployments or releases.
- Automated validation of enterprise .NET applications.
Example
This example demonstrates how to execute test assemblies and generate a test report.
Scenario
Run tests and generate a report.
Configuration settings:
- Step Name: Run Tests
- Working Directory:
C:\Projects\MyApp\Tests - Test Assembly:
MyApp.Tests.dll - Reports Folder:
C:\Reports - Report Name:
test-results - Fail Criterion: Fail if failures > 5%
- Arguments:
/Parallel
Limitations
- p;Requires test assemblies to be pre-built before execution.
- Primarily Windows-focused tooling.
- Test environments must be correctly configured and consistent.
- Long-running test suites can significantly increase build duration.
Best Practices
- Separate fast and slow tests to optimize feedback cycles.
- Fail fast for critical or blocking test failures.
- Archive and retain test reports for traceability and audits.
- Version test assemblies alongside application code.