.NET Coreユニットテスト関連コマンド

1233 ワード

使用するPowerShellコマンド
1.プロジェクト関連コマンドの作成
ls 
mkdir
Ni(new-item)空のファイルを作成する
add-contentファイルへのコンテンツの追加
typeファイルを開く
dotnet new sln空のソリューションの作成
dotnet sln add *.csprojソリューションへのプロジェクトの追加
dotnet new classlib作成プログラムセット
dotnet new mstest(MSTestプロジェクトの作成)
dotnet add reference *.csproj(現在のプログラムセットに他のプログラムと参照を追加)
2.テスト関連コマンドの実行
dotnet test実行すべて
テスト
dotnet test--filter Method(Methodを含むフルネームのテスト方法を実行)
dotnet test--filter Name~TestMethod 1(実行名にTestMethod 1を含む方法)
dotnet test --filter ClassName=MSTestNamespace.UnitTest 1(MSTestNamespace.UnitTest 1クラスのテストを実行)
dotnet test --filter FullyQualifiedName!=MSTestNamespace.UnitTest1.TestMethod 1(MSTestNamespace.UnitTest 1.TestMethod 1以外のすべてのテストを実行)
dotnet test--filter TestCategory=CategoryA([TestCategory("CategoryA")]コメントを含むテストを実行します.)
dotnet test--filter Priority=2([Priority(2)]コメントを含むテストを実行します.)
dotnet vstest .dllは、パブリッシュされたテスト項目に対してテストを実行します(アプリケーションがnetcoreapp以外のフレームをターゲットとしている場合は、フレームフラグを使用してターゲットフレームに転送することでdotnet vstestコマンドを実行できます.dotnet vstest.dll--Framework:「.NETframework,Version=v 4.6」).
転載先:https://www.cnblogs.com/fmys/p/10206411.html