简体   繁体   English

Asp.net核心 - 找不到dotnet测试

[英]Asp.net core - dotnet test not found

I have an asp.net core application and i want to do some x-unit testing on it. 我有一个asp.net核心应用程序,我想对它进行一些x-unit测试。 However, when i run my tests i get 但是,当我运行我的测试时,我得到了

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

How do i configure x-unit properly ? 如何正确配置x-unit?

Project.json 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"
      ]
    }
  },

You forgot the testRunner property: 你忘了testRunner属性:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM