【问题标题】:How to pass TestRunParameters to "dotnet test" command directly from command line如何直接从命令行将 TestRunParameters 传递给“dotnet test”命令
【发布时间】:2019-09-26 08:43:16
【问题描述】:

下面是运行设置文件,定义了自定义参数。

<?xml version="1.0" encoding="utf-8"?>
    <RunSettings>
      <TestRunParameters>
        <Parameter name="publishResults" value="true" />
      </TestRunParameters>
    </RunSettings>

这就是我从命令行运行命令的方式 dotnet test MyTests --settings develop.runsettings --no-build

我想避免 .runsettings 并且喜欢这样运行 dotnet test MyTests --publishResults true --no-build

有可能吗?

【问题讨论】:

    标签: testing .net-core command-line mstest


    【解决方案1】:

    是的,有可能,但是您的语法不正确。在this 文档中,您可以这样称呼它:

    dotnet test MyTests --no-build -- publishResults=true
    

    注意 RunSettings 参数是 last 传入的参数。还要注意--publishResults=true 之间有一个空格。该空间指定后面的参数用于 RunSettings。

    【讨论】:

      猜你喜欢
      • 2019-08-28
      • 1970-01-01
      • 2016-10-25
      • 2014-07-19
      • 2015-03-23
      • 2018-12-29
      • 2015-08-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多