【问题标题】:Powershell error in Executing NUnit test执行 NUnit 测试时出现 Powershell 错误
【发布时间】:2010-01-21 16:52:02
【问题描述】:

这可能听起来很傻,但我一直在尝试使用 powershell 脚本执行 NUnit 测试,尝试了几次但没有希望。有不同的格式还是我需要添加插件?

如有任何帮助,将不胜感激...

Command = "c:\Program Files\NUnit 2.4.8\bin\nunit-console.exe" /config=Release "C:\projects\IntegrationTests\IntegrationTests.nunit" 2>&1

输出如下:

PS C:\tests> "c:\Program Files\NUnit2.4.8\bin\nunit-console.exe" /config=Release

"C:\projects\IntegrationTests\IntegrationTests.nunit" 2>&1

您必须在“/”运算符的右侧提供一个值表达式。

在 line:1 char:55 + "c:\Program Files\NUnit 2.4.8\bin\nunit-console.exe" /

config=Release "C:\projects\IntegrationTests\IntegrationTests.nunit" 2>&1

提前致谢

【问题讨论】:

    标签: nunit powershell-2.0 nunit-console


    【解决方案1】:

    你没有放零件

    /config=Release
    

    在您引用的命令文本中。

    你的命令应该看起来像

    "c:\Program Files\NUnit 2.4.8\bin\nunit-console.exe /config=Release C:\projects\IntegrationTests\IntegrationTests.nunit" 2>&1
    

    ...我没有检查 nunit-console.exe 命令行选项,但我想您已经测试过 nunit 命令是否有效。

    【讨论】:

    • Powershell 观点:您必须在行首放一个“&”,这样它就不会被视为字符串,而是要执行的命令。 | NUnit 观点:/config=Release 等选项必须放在最后
    • @Cédric 感谢 nunit 方面的支持......考虑到我应该指出的问题,将命令字符串分配给变量需要 $Command = "..."
    • 感谢您的帮助,确实帮助了我... 2.4.\bin\nunitconsole.exe' /config=Release C:\Projects\IntegrationTests\IntegrationTests.nunit 2>&1 非常感谢。
    【解决方案2】:

    抱歉顶部对话框中的混乱,下面是正确的代码版本

    & 'c:\Program Files\NUnit 2.4.\bin\nunitconsole.exe' /config=Release C:\Projects\IntegrationTests\IntegrationTests.nunit 2>&1
    

    【讨论】:

      猜你喜欢
      • 2011-06-11
      • 1970-01-01
      • 2013-02-09
      • 1970-01-01
      • 1970-01-01
      • 2020-04-30
      • 1970-01-01
      • 2016-09-09
      • 1970-01-01
      相关资源
      最近更新 更多