【问题标题】:Is there any way to run Nunit test using test adapter in command prompt?有没有办法在命令提示符下使用测试适配器运行 Nunit 测试?
【发布时间】:2018-04-20 10:59:15
【问题描述】:

我想在 使用 CMD 任务的 VSTS CI 管道中使用它。我看到它可以使用 nunit3-console.exe 完成,但它需要安装在构建服务器,我不想 VSTest 任务。

【问题讨论】:

  • 您能告诉我们为什么stackoverflow.com/a/11085857/34092 不能满足您的需求吗? github.com/nunit/docs/issues/64 有帮助吗?
  • 包含有关您的问题的更多详细信息
  • 它说使用我需要安装在构建服务器中的 NUnint 控制台,我不想要它。我听说 NUnit 适配器可用于在命令提示符下运行测试。但没有得到任何帮助到现在。
  • 不允许。 :(
  • 谁说不允许的?为什么他们说这是不允许的?

标签: c# continuous-integration nunit azure-devops


【解决方案1】:

Visual Studio Test任务调用vstest.console.exe工具运行测试,可以查看命令详细日志。

首先,将 NUnitNUnit3TestAdapter nuget 包安装到您的测试项目中。

其次:

对于.net框架项目,只需像这样调用命令:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" {test assembly (dll) path} /logger:trx /TestAdapterPath:{package folder path}

对于 .net 核心项目:

  1. 在NuGet还原任务的目标目录输入框中指定包路径
  2. 命令:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" {test assembly (dll) path} /logger:trx "/TestAdapterPath:\"{package path (step 1)} \"" /framework:.NETCoreApp,Version=v2.0

【讨论】:

    猜你喜欢
    • 2016-10-24
    • 2014-01-03
    • 1970-01-01
    • 1970-01-01
    • 2016-01-13
    • 2012-06-20
    • 2011-03-29
    • 2011-02-24
    • 1970-01-01
    相关资源
    最近更新 更多