在VS开发人员命令提示符之外运行单元测试?

时间:2014-03-18 11:21:21

标签: c# unit-testing batch-file visual-studio-2012 command-prompt

问题背景:

我已经生成了一个运行我的单元测试项目的.dll的批处理文件。在Visual Studio开发人员命令提示符中运行此命令非常有效。我现在希望能够通过标准的MS-DOS命令提示符运行此批处理文件。

问题:

这是当前的批处理文件命令:

cd C:\Users\Me\Desktop\WebService\CalcUnitTests

MSTest/testcontainer:C:\Users\Me\Desktop\WebService\Calc\CalcUnitTests\bin\Debug\CalcUnitTests.dll

在MS-DOS NON-Developer提示符上运行上述批处理文件命令会产生错误:

'MSTest' is not recognized as an internal or external command, operable program or batch file.

如何通过标准命令提示符运行上述批处理文件?任何信息都会非常有用。

编辑:

我现在更新了我的环境变量,但在运行批处理文件时仍然收到相同的无法识别的'MSTest'错误:

enter image description here

1 个答案:

答案 0 :(得分:2)

您需要找到MSTest的路径,这取决于您安装的Visual Studio的版本,然后您需要将该路径添加到PATH环境变量,以便MSTest命令可用于任何应用程序,包括非dev MS-DOS命令提示符。

路径应如下所示:

"%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe"