Q: Run Web Test Using MSTest Command-Line Failed
Run Web Test Using MSTest Command-Line Failed
I got an email asking me to help with msdn forum request.
Q:
I am trying to run a delegated WebTest from the command line using MStest. I have VSTS 2008 Suite Edition Installed. If I go to the command prompt from VSTS first (start-->all programs-->microsoft visual studio 2008-->visual studio tools-->visual studio 2008 comand prompt),
then go to the directory where my Webtest resides, then run my Webtest with mstest, it runs.
But if I go to the command prompt in the normal way, go to the directory where my Webtest resides, the mstest command fails with the error message: " 'mstest' is not recognized as an internal or external command".
I looked in the Forum and found an old entry from 2006 at http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/a6b15c77-6ffc-4c03-9d43-c5f37f922b2d/ that told me to "You'll need to add mstest.exe's location to the PATH environment variable.
Open a command window and execute this command: path=%path%;locationOfMstestExe".
I tried this command at the command prompt from within VSTS and normally.
Then tried to run my WebTest and I get the same error unless I run it from within the VSTS command prompt. How can I fix this? I need to be able to run WebTests in batch mode.
A:
This is the path Visual Studio used.
@set PATH=c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;c:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;c:\WINDOWS\Microsoft.NET\Framework\v3.5;c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;c:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;%PATH%
@set INCLUDE=c:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE;c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE;%INCLUDE%
@set LIB=c:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB;c:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;%LIB%
@set LIBPATH=c:\WINDOWS\Microsoft.NET\Framework\v3.5;c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;c:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB;c:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;%LIBPATH%
You can set the PATH by default to use c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE.
Right Click on "My Computer" -> Advanced –>

"Enviorment Variables" –>
in "System Variables" select "Path" and click "Edit"
This is the default -
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\HPQ\IAM\bin;C:\Program Files\Intel\DMIX;c:\Program Files\Microsoft SQL Server\90\Tools\binn\
Change it to -
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\HPQ\IAM\bin;C:\Program Files\Intel\DMIX;c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;c:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;c:\WINDOWS\Microsoft.NET\Framework\v3.5;c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;c:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;
Result:
I added your new path to my path of my environment variable path, and it worked like a champ! Thanks! -Jill