DevOps for your Organization – Part 6: Automated Unit Tests
In our previous post, we covered what branch policies are, how to create them, and how they can improve your team’s development experience.
The next step in your DevOps process is to add automated unit tests to your continuous integration builds. By including automated unit tests, you guarantee that all new code checked in to your master branch via pull requests will pass all your tests. It is one more quality gate to maintain the integrity of your code.
Azure DevOps has native support for a variety of testing frameworks in both their build and release processes. Additionally, they support third-party plugins for the frameworks that they do not support. As of this writing (November 2019), they support:
- Coded UI
As well as many more. See Microsoft’s official documentation for more information about the capabilities of the tool.
Adding Unit Tests to your Build
In order to add unit tests to your build or release, you need only add the Visual Studio Test task to your build. If you’ve got only one solution in your and your test project has the word test in it, the default configuration should do:
# Run tests
- task: VSTest@2
displayName: Run Tests
Otherwise, you can use the task’s configuration pane to help you fill out the YAML. The information bubbles are a significant help.
Automated unit tests are a great way to ensure that code changes coming in to your repository do not break your current functionality. They can be a quick and easy sanity check that code changes in one segment of the solution haven’t had unintended downstream effects. In a great article by Munil Shah, former director of engineering, developer services, cloud and AI division at Microsoft, he covers Azure DevOps transition from traditional development practices to DevOps. In it, he specifically address how they transformed their unit test practice.
Let Us Help You Out!
Code Vanguard has worked with clients of all sizes, helping them to use DevOps practices to accelerate their time to delivery. If you’d like Code Vanguard to help your organization with your DevOps process, feel free to reach out to us!
This post is part of the DevOps for your Organization series, where we walk through some basic steps you can take to move your organization towards the DevOps process. The full series can be found here. If you’d like Code Vanguard to help your organization with its DevOps process, feel free to reach out to us!