我有一個使用Xunit 2.2的.NET Core測試項目。我的一些測試被標記爲特徵。你如何用「dotnet test」特性過濾xunit測試?
[Fact]
[Trait("Color", "Blue")]
public void TestBlue()
{
}
什麼是「DOTNET測試」正確的命令行語法僅運行測試,其中性狀顏色==藍?
我正在使用.NET Core CLI 1.0.0-rc4,它使用csproj而不是project.json。
我試圖使用dotnet test --filter $something
,但無論我用$的東西,我看到這個錯誤:
Error: [xUnit.net 00:00:00.7800155] E2ETests: Exception filtering tests: No tests matched the filter because it contains one or more properties that are not valid ($something). Specify filter expression containing valid properties (DisplayName, FullyQualifiedName) and try again.
我仍然得到錯誤關於'(DisplayName,FullyQualifiedName)'關於爲什麼這被打破的任何指針(使用cli 1.0.3) – Damian
N當然,需要更多的細節。作爲一種解決方法,您可以嘗試使用'dotnet-xunit'代替。見http://xunit.github.io/docs/getting-started-dotnet-core.html – natemcmaster
以下工作: 'DOTNET測試--filter TraitName = TraitValue' 然而,只有只要有一些在測試程序集中用'[Trait(「TraitName」,「somevalue」)]'裝飾的測試......如果沒有測試得到運行:-(。可能是dotnet測試中的一個錯誤? –