John John - 3 months ago 53
ASP.NET (C#) Question

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. However, when i run my tests i get

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


How do i configure x-unit properly ?

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

Answer

You forgot the testRunner property:

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