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

标签 asp.net-core xunit .net-core dotnet-cli .net-core-rc2

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/

相关文章:

c# - .NET 核心 2.2 : xUnit Theory Inlinedata not working with enum values

.NET Core自定义模型绑定(bind)器调用默认模型绑定(bind)器

c# - 如何在ASP.NET Core中处理路由请求 "john.myexample.com"

.net - 在 .Net Core 应用程序中使用 SharePoint CSOM

c# - 指定 xUnit Theory 测试的返回值

xunit - 使用 EF Core In Memory 提供程序时无法在单元测试期间获取 EF Core 日志

c# - AddDbContext 在 .NET Core 的 IServiceCollection 中不可用

.net-core - .NET Core 存储应用程序设置的方式是什么?

c# - 是否可以在不创建 ViewModel 对象的情况下从 .NET 中的 REST api 获取复杂的 Entity Framework 对象?

compilation - Dotnet CLI 编译性能在控制台或 Visual Studio 2015 上很慢