Microsoft MSTest Command-Line Test Runner
mstest.exe is the Microsoft MSTest command-line runner used to execute unit tests from a build, script, or CI system. It coordinates test discovery, execution, and result reporting for .NET projects using MSTest frameworks. When started, it loads test assemblies, applies adapters, and runs tests, producing a TRX or XML report that automation dashboards rely on.
MSTest.exe runs tests through the MSTest framework, leveraging the discovery engine to locate test methods, instantiate test classes, and capture outcomes. It supports attributes, data-driven tests, and result logging suitable for CI pipelines.
Mstest.exe is a legitimate Microsoft testing tool when obtained from official Visual Studio or .NET SDK installations. It is digitally signed by Microsoft and designed for running unit tests in development and CI workflows. To maintain safety, verify the source path, ensure the binary matches the expected VS version, and avoid executing copies renamed as mstest.exe that originate from untrusted sources.
Although mstest.exe itself is a legitimate Microsoft tool, malicious software can imitate it by placing a variant in deceptive folders or altering a signed binary. Always confirm the file path, publisher, and digital signature before execution. Use up-to-date antivirus scans, compare hashes with official releases, and review system behavior for unexpected MSTest activity.
Red Flags: mstest.exe found outside standard VS/Build Tools directories, a non-Microsoft signature, unexpected modification times, or anomalous network behavior during test runs should trigger immediate secondary verification and scanning.
Reasons it's running:
Mstest.exe runs MSTest tests from the command line, enabling automated test execution in build pipelines and local development.
Typically under C:\Program Files (x86)\Microsoft Visual Studio\<version>\Common7\IDE or under the Visual Studio Build Tools path.
Yes, with the Visual Studio Test Platform or Build Tools installed, you can run mstest.exe via the command line.
Check the file path, digital signature, and hash; compare with official Microsoft sources and run antivirus scans.
Some AV programs flag command-line test runners; whitelisting and ensuring signature verification usually resolves the issue.
MSTest V1 and V2 are supported depending on the adapter and VS version installed; MSTest V2 is recommended for new projects.
Use the appropriate switches (for example /testcontainer and /resultsfile) to produce a TRX file for CI dashboards.