问与答 在没有Visual Studio的情况下如何使用MSTest?

everett · 2020-02-20 22:28:18 · 热度: 15
共收到 6 条回复
darrell #1 · 2020-02-20 22:28:18

可以在不安装Visual Studio的情况下使用MSTest。 您将需要安装Visual Studio测试代理,它可以从Microsoft免费下载。

从授权的角度来看,我认为这种方法比手动将MSTest.exe及其依赖项复制到生成服务器更好。

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

darrell #2 · 2020-02-20 22:28:19

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

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

darrell #3 · 2020-02-20 22:28:21

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

darrell #4 · 2020-02-20 22:28:22

将Gallio用作您的测试运行者...那么当您热衷于放弃MsTest并转而使用真正的测试框架时,它就不算什么了。

darrell #5 · 2020-02-20 22:28:23

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

darrell #6 · 2020-02-20 22:28:24

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

所需步骤:

  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

此处有更多详细信息:[https://docs.microsoft.com/zh-cn/visualstudio/test/vstest-console-options?view=vs-2017#general-command-line-options]

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册