Where is mstest.exe located?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
MSTest is a testing framework provided by Microsoft for running automated tests on .NET applications. `mstest.exe` is the command-line tool used to execute these tests. Finding the location of `mstest.exe` is a common task when configuring build servers or setting up development environments. This article will provide a comprehensive guide on where to find `mstest.exe` and how to utilize it effectively.
Locating `mstest.exe`
The location of `mstest.exe` can vary depending on the version of Visual Studio and the .NET framework installed on your system. Let's explore the typical installation paths.
Installation Paths
Visual Studio 2019 and Earlier
For versions of Visual Studio 2019 and earlier, `mstest.exe` is part of the Visual Studio setup. The executable is located in the Team Test Agent or different editions of Visual Studio (Enterprise, Professional, Community). The typical path is:
- `C:\Program Files (x86)\Microsoft Visual Studio``<Version>````<Edition>``\Common7\IDE\MSTest.exe`
For example:
- Visual Studio 2019 Enterprise:
`C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\MSTest.exe`
Visual Studio 2022 and Later
Starting with Visual Studio 2022, the availability and location of `mstest.exe` may differ due to changes in the architecture, as Visual Studio now supports 64-bit installations. It is generally found at:
- `C:\Program Files\Microsoft Visual Studio\2022``<Edition>``\Common7\IDE\MSTest.exe`
Visual Studio Build Tools
If you've installed Visual Studio Build Tools instead of the full Visual Studio IDE, you might find `mstest.exe` in a path similar to:
- `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\MSTest.exe`
Command Line Interface (CLI) Tools
For developers who use the .NET Core CLI tools, MSTest can be used with `dotnet test` command. While this approach does not require `mstest.exe`, understanding where the executable resides is crucial for interfacing with legacy systems.
How to Use `mstest.exe`
Once you have located `mstest.exe`, you can start executing your test suites from the command line.
Basic Command:
To execute tests using `mstest.exe`, open a command prompt and navigate to the directory containing your `.testsettings` or `.runsettings` file. Then use the following command:
- `/testcontainer`: Points to the DLL or EXE file that contains the tests.
- `/resultsfile`: Specifies the output file for test results.
- `/test`: Executes a particular test.
Related reading
- Where is the Application.DoEvents in WPF?
- Where is the constant for HttpRequest.RequestType and WebRequest.Method values in .NET?
- Where is the Global.asax.cs file?
- Which built-in .NET exceptions can I throw from my application?
- Where is the Create Unit Tests selection?
- Which unit testing framework?
- Which is generally best to use — StringComparison.OrdinalIgnoreCase or StringComparison.InvariantCultureIgnoreCase?
- Which members of .NET's ConcurrentDictionary are thread-safe?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.