Tôi vừa nâng cấp Dự án của mình lên .Net Core 1.1 và tất cả các thử nghiệm của tôi không được phát hiện ngay bây giờ. Nó được làm việc tốt khi nó được trong phiên bản cũ (Net Lõi 1.0)XUnit Các thử nghiệm không còn được phát hiện trong .Net Core 1.1
Sau đây là thông điệp trong VS 2015 Output Window được tạo ra bởi XUnit
------ Discover test started ------
Discovering tests in 'C:\TW\websites2016\AssetsDB\src\Tests\project.json' ["C:\Program Files\dotnet\dotnet.exe" test "C:\TW\websites2016\AssetsDB\src\Tests\project.json" --output "C:\TW\websites2016\AssetsDB\src\Tests\bin\Debug\netcoreapp1.1" --port 61778 --parentProcessId 7316 --no-build]
'test-xunit' returned '-532462766'.
========== Discover test finished: 0 found (0:00:01.7697049) ==========
Codes trong project.json
{
"version": "1.0.0-*",
"testRunner": "xunit",
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"AssetsDB": { "target": "project" },
"xunit": "2.2.0-beta4-build3444",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
},
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": [
"dotnet5.4",
"portable-net451+win8"
]
}
}
}
mẫu của tôi thử nghiệm:
namespace Tests
{
public class QueryPagingAssetsTest
{
[Fact]
public void should_return_PagingAssetItems()
{
Assert.True(xxxxx);
}
}
}
có điều gì tôi đang thiếu? Tôi có cần phải thay đổi bất cứ điều gì để làm cho nó tương thích với .Net Core 1.1?
CẬP NHẬT: Phiên bản làm việc của project.json
Bạn cần phải thêm thư viện InternalAbstractions. Nếu bạn theo liên kết của Brad, nó sẽ cho bạn biết để sử dụng "xunit.runner.visualstudio" thay vì "xunit.runner.visualstudio". Nhưng AFAIK, nó không làm việc được nêu ra (tính đến 09/12/2016)
"dependencies": {
"AssetsDB": { "target": "project" },
"Microsoft.DotNet.InternalAbstractions": "1.0.1-beta-003206",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"xunit": "2.2.0-beta4-build3444",
"dotnet-test-xunit": "2.2.0-preview2-build1029"
//"xunit.runner.visualstudio": "2.2.0-beta4-build1194"
},