I am executing VSTS Performance test (that is .webtest file) using the command prompt, test runs successfully when I specify the name of the result file explicitly. But when I don't specify that and I want VSTS to generate the result .trx file on its own (with timestamp and machine name), then the test fails.

Currently I am using this:

c:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE>MSTest.exe/TestContainer:"C:\Path\TC.webtest" /testsettings:"C:\Path2\Local.testsettings"

and getting an error:

Error when trying to save result file: Could not find a part of the path 'c:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\TestResults\username_Mac 2016-05-26 11_18_41.trx'.

Actually I don't have permissions to write to this location 'c:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\', so I am getting this error.

Is there a way in which I can specify only the path of Result File through command prompt (where I have write permissions) and then VSTS will automatically creates the result file at that location with the naming syntax. In short I don't want to change the Result File name manually, every time test is executed via cmd, it should create a new file.

I have gone through the following links and using Visual Studio 2013 Ultimate: https://blogs.msdn.microsoft.com/slumley/2008/12/22/running-web-and-load-tests-from-the-command-line/



1 Answer 1


The command used is

c:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE>MSTest.exe/TestContainer:"C:\Path\TC.webtest" /testsettings:"C:\Path2\Local.testsettings"

This means that the current directory is

c:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE

and the command being executed is

MSTest.exe/TestContainer:"C:\Path\TC.webtest" /testsettings:"C:\Path2\Local.testsettings"

In theses circumstances mstest.exe tries to write the results to a subdirectory of the current directory.

The solution is to set the current directory to be where you want the results, or to a parent of that directory. The following command should work:

cd C:\Path\
"c:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" /TestContainer:"TC.webtest" /testsettings:"C:\Path2\Local.testsettings"
  • Thanks, it worked :) But I observed one thing that if I execute load test for 5 users via Command Prompt then Response time is much less than the same load test executed via Visual Studio. Is that a normal behavior? or I am doing something wrong?
    – Dhiman
    May 26, 2016 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.