The MSTest tool doesn't pick up the mstest.exe from Visual Studio 2017
See original GitHub issueWhat You Are Seeing?
I run the unit tests like this:
MSTest("./src/**/bin/" + configuration + "/*.Tests.dll");
I get the following error when running the build script:
An error occurred when executing task 'Run-Unit-Tests'.
Error: MSTest: Could not locate executable.
What is Expected?
I expect my unit tests to run.
What version of Cake are you using?
0.17
Are you running on a 32 or 64 bit system?
64 bit
What environment are you running on? Windows? Linux? Mac?
Windows 10
Are you running on a CI Server? If so, which one?
No, just building on my local machine.
How Did You Get This To Happen? (Steps to Reproduce)
Run a build with unit tests on a machine with only Visual Studio 2017 (Community Edition).
Output Log
========================================
Run-Unit-Tests
========================================
Executing task: Run-Unit-Tests
An error occurred when executing task 'Run-Unit-Tests'.
Error: Cake.Core.CakeException: MSTest: Could not locate executable.
at Cake.Core.Tooling.Tool`1.RunProcess(TSettings settings, ProcessArgumentBuilder arguments, ProcessSettings processSettings)
at Cake.Core.Tooling.Tool`1.Run(TSettings settings, ProcessArgumentBuilder arguments, ProcessSettings processSettings, Action`1 postAction)
at Cake.Core.Tooling.Tool`1.Run(TSettings settings, ProcessArgumentBuilder arguments)
at Cake.Common.Tools.MSTest.MSTestRunner.Run(IEnumerable`1 assemblyPaths, MSTestSettings settings)
at Cake.Common.Tools.MSTest.MSTestAliases.MSTest(ICakeContext context, IEnumerable`1 assemblyPaths, MSTestSettings settings)
at Cake.Common.Tools.MSTest.MSTestAliases.MSTest(ICakeContext context, IEnumerable`1 assemblyPaths)
at Cake.Common.Tools.MSTest.MSTestAliases.MSTest(ICakeContext context, String pattern)
at Submission#0.<.ctor>b__11()
at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass5_0.<Does>b__0(ICakeContext context)
at Cake.Core.ActionTask.Execute(ICakeContext context)
at Cake.Core.DefaultExecutionStrategy.Execute(CakeTask task, ICakeContext context)
at Cake.Core.CakeEngine.ExecuteTask(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask task, CakeReport report)
at Cake.Core.CakeEngine.RunTarget(ICakeContext context, IExecutionStrategy strategy, String target)
at Cake.Scripting.BuildScriptHost.RunTarget(String target)
at Submission#0..ctor(Session session, Object& submissionResult)
at Submission#0.<Factory>(Session session)
at Roslyn.Scripting.CommonScriptEngine.Execute[T](String code, String path, DiagnosticBag diagnostics, Session session, Boolean isInteractive)
at Roslyn.Scripting.Session.Execute(String code)
at Cake.Scripting.Roslyn.Stable.DefaultRoslynScriptSession.Execute(Script script)
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
at Cake.Commands.BuildCommand.Execute(CakeOptions options)
at Cake.CakeApplication.Run(CakeOptions options)
at Cake.Program.Main()
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (12 by maintainers)
Top Results From Across the Web
Can I use mstest.exe without installing Visual Studio?
It is possible to run mstest.exe without visual studio. Download one of the Agents for Visual Studio ISO's below and install the Test...
Read more >VSTest.Console.exe command-line options - Visual Studio ...
Learn about the VSTest.Console.exe command-line tool that runs tests. This article includes the General command-line options.
Read more >Test Explorer not discoverying test methods
There is a bug either in MSTest or Nuget where the correct set of assemblies are not loaded, and that causes tests to...
Read more >FAQs and Troubleshooting
What if unit tests using MSTest V1 framework are not executed? ... Why is dotTEST unable to find build artifacts in Visual Studio...
Read more >Visual Studio Tests | TeamCity On-Premises Documentation
The Visual Studio Tests build runner integrates functionality of the MSTest ... Select the tool used to run tests: VSTest or MSTest.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looking forward to the fix. This is the workaround I’ve been using:
Then just wrap your settings:
(See https://github.com/Microsoft/vswhere/wiki/Find-VSTest.)
I had the same issue - as @phillipsj already mentioned, the ToolPath did the trick (even it is not super “clean”)