Categories
Software Engineering

Automated Testing With MSTest V2

What is Microsoft’s MSTest Framework? Why is it used?

MSTest is a Unit Testing framework in Visual Studio that allows you to test .NET Apps. The MSTest Test Framework can be installed as a set of NuGet Packages & is a very effective way to automate tests. You can save the test functions in their own test classes & execute them manually in test runner to have them ready for CICD Automation.

How Does MSTest Relate to CICD?

MSTest is part of Continuous Integration. After a developer would push code to the Dev Environment, MSTest would then execute all of its tests to make sure there are no bugs. With MSTest you can identify failed unit tests to spot bugs faster & make sure none of the tests fail before moving the code to Dev, Staging, & Production.

MSTest Methods can be run manually but the real value is having them run automatically before pushing code to any master branch & then having MSTest run before pushing to master branch and after pushing to master branch.

This process would be automated using various scripts & tools such as Azure DevOps, & Ansible as part of the CICD Pipeline setup.

Elements of MSTest

At a high level, we can think of MSTest to be made of these elements below which describe the various functions and features of MSTest V2.