gpt4 book ai didi

asp.net-core - .NET Core 1.0 - 如何使用 xUnit 命令行运行 "All tests in Solution"

转载 作者:行者123 更新时间:2023-12-04 19:30:12 26 4
gpt4 key购买 nike

Getting started with xUnit.net (.NET Core / ASP.NET Core)页面描述了如何使用 dotnet test 运行测试命令行。

它声明它需要一个特定的 project.json,我们在其中添加 xunit 依赖项和测试运行程序:

  "testRunner": "xunit",
"dependencies": {
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-build10015"
}

如果我尝试从父目录调用它:
C:\git\Project\test [master ≡]> dotnet test
dotnet-test Error: 0 : System.InvalidOperationException: C:\git\Project\test\project.json does not exist.
at Microsoft.DotNet.Tools.Test.TestCommand.GetProjectPath(String projectPath)
at Microsoft.DotNet.Tools.Test.TestCommand.DoRun(String[] args)
C:\git\Project\test [master ≡]>

问题:有没有办法用一个 dotnet test 运行所有测试(多个 project.json) ?

最佳答案

如果有人在寻找 Windows 答案,这里是 PowerShell 中的 oneliner 可以完成这项工作:
dir test | % { dotnet test $_.FullName }

关于asp.net-core - .NET Core 1.0 - 如何使用 xUnit 命令行运行 "All tests in Solution",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37323364/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com