没有找到Asp.net核心-.net测试

本文关键字:net 核心 测试 Asp | 更新日期: 2023-09-27 18:06:10

我有一个asp.net核心应用程序,我想对它做一些x单元测试。但是,当我运行测试时,我得到

dotnet test
No executable found matching command "dotnet-test-"

如何正确配置x-unit ?

Project.json

  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0-rc2-final",
    "xunit": "2.1.0",
    "dotnet-test-xunit": "1.0.0-rc2-build10025"
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

没有找到Asp.net核心-.net测试

您忘记了testRunner属性:

{
  "dependencies": {
    ...
    "dotnet-test-xunit": "2.2.0-*",
    "xunit": "2.2.0-*"
  },
  ...
  "testRunner": "xunit"
}