This post is about running aspnet core unit tests with MS Test. Few days back Microsoft announced support of MS Test for ASP.NET Core RC2 applications. And MS released two nuget packages to support the development as well as tooling. Similar to XUnit, MS Test also require reference of MS Test Framework and tool to run the unit tests aka Test Runner. So in the project.json file add reference of “dotnet-test-mstest”, which the test runner and “MSTest.TestFramework” is the framework.
Here is the project.json file.
I have removed all the sections in the project.json file which is not relevant to this blog post. Now you can write the test cases using MS Test attributes and execute the tests with “dotnet test” command.
Here is the simple asp.net core unit test with MS Test.
Here is the typical output you will get while executing the tests.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.