2017年8月26日 星期六

[.Net Core] Run unit test in VSCODE

 .NET Core    Unit Test       Visual Studio Code   





Introduction


Here are some quick ways to run unit tests in VSCODE.


Walk thru


Create a UnitTest project

Take MS TEST project for example.

$ dotnet new mstest --name Test
$ cd Test
$ dotnet restore
$ dotnet build


VSCODE extension: C#

Install the C# extension in VSCODE.




And you can run the unit test on code lens.




Or simply use the dotnet cli command.

$ dotnet test


VSCODE extension: .NET Core Test Explorer

Install the .NET Core Test Explorer extension in VSCODE.




We can specify the target unit-test project relative path by the following work space settings.

settings.json

{
    "dotnet-test-explorer.testProjectPath": "Test"
}



Now we can use the .NET TEST EXPLORER to run the unit tests.







沒有留言:

張貼留言