visual-studio 如何在没有 Visual Studio 的情况下使用 MSTest?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/261290/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 09:51:32  来源:igfitidea点击:

How do I use MSTest without Visual Studio?

visual-studio-2010visual-studiounit-testingmstest

提问by bitbonk

Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio? What is the official site for MSTest where I can learn more about how to use it?

MSTest 是否具有类似于 nUnit 的独立 GUI,可让我使用它并在没有 Visual Studio 的情况下运行测试?MSTest 的官方网站是什么,我可以在那里了解有关如何使用它的更多信息?

采纳答案by Alexander Kojevnikov

It doesn't have a GUI (apart from Visual Studio) but there's a command line tool: MSTest.exe

它没有 GUI(除了 Visual Studio),但有一个命令行工具:MSTest.exe

Here is the official documentation on running MSTest tests.

这是有关运行 MSTest 测试的官方文档。

回答by boris

MSTest can be used without installing Visual Studio. You will need to install Visual Studio Test Agent, which is a free download from Microsoft.

无需安装 Visual Studio 即可使用 MSTest。您将需要安装 Visual Studio 测试代理,可从 Microsoft 免费下载。

I think this approach is better from a licensing perspective than manually copying MSTest.exe and its dependencies onto the build server.

我认为从许可的角度来看,这种方法比手动将 MSTest.exe 及其依赖项复制到构建服务器上要好。

See this blog for reference: http://blogs.msdn.com/b/anutthara/archive/2009/12/16/running-tests-in-mstest-without-installing-the-vs-ide.aspx

请参阅此博客以供参考:http: //blogs.msdn.com/b/anutthara/archive/2009/12/16/running-tests-in-mstest-without-installing-the-vs-ide.aspx

回答by Wim Coenen

You can do this with mstest.exe, but the trick is in getting it to work without installing visual studio. This involves the copying of several files and registry entries. I have blogged about it here.

您可以使用 mstest.exe 执行此操作,但诀窍在于无需安装 Visual Studio 即可使其工作。这涉及复制多个文件和注册表项。我已经在这里写了关于它的博客。

回答by RhysC

Use Gallioas your test runner... then its not so much of a drama when you enventually drop MsTest and move to a real test framework.

使用Gallio作为您的测试运行器……那么当您最终放弃 MsTest 并转向真正的测试框架时,它就不是那么戏剧性了。

回答by Peter Schmitz

You can also use this tool from codeplex: http://testrunner.codeplex.com...

您也可以从 codeplex 使用此工具:http: //testrunner.codeplex.com...

回答by Siraf

Use VSTest.console.exepart of Microsoft.TestPlatform

使用Microsoft.TestPlatform 的VSTest.console.exe部分

Required steps:

所需步骤:

  1. Download the test platform from https://www.nuget.org/packages/Microsoft.TestPlatform/
  2. Unzip
  3. In the unzipped folder, copy the \tools\net451\Common7\IDE\Extensions\TestPlatformfolder to the machine that has no Visual Studio installed
  4. From cmd.exe run VSTest.console.exe MyTest.dll
  1. https://www.nuget.org/packages/Microsoft.TestPlatform/下载测试平台
  2. 解压
  3. 在解压后的文件夹中,将\tools\net451\Common7\IDE\Extensions\TestPlatform文件夹复制到没有安装Visual Studio的机器
  4. 从 cmd.exe 运行VSTest.console.exe MyTest.dll

More details here:https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2017#general-command-line-options

更多详细信息:https: //docs.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2017#general-command-line-options