I have stepped up my game over the years such that Visual Studio is now my dashboard for the quality metrics of the systems I build.
Specifically, I dock the Test Explorer and Code Coverage window under my Solution Explorer. Thus, every time I build my solution, my unit tests automatically get executed and I am able to observe a red or green bar that reflects test results.
In addition, I have created a shortcut for executing Code Coverage analysis. I often run this report about a dozen times a day so that I can identify dead code as well as gaps within my unit tests.
To create a shortcut for executing Code Coverage, perform the following:
- Type Ctrl + Q
- Observe the cursor on the QuickSearch searchbox is now set
3. Type “Shortcuts” in the searchbox
4. Select the “Environment -> Keyboard” option
5. Observe navigation to: Options | Environment | Keyboard
6. Set a shortcut to CodeCoverage:
7. Apply the update for the short cut.
8. Within the editor, type: Alt+C, Alt+C
9. Observe test execution and a CodeCoverage report gets generated:
In conclusion, I have stepped up my game over the years such that Visual Studio is now my dashboard for the quality metrics of the systems I build. Thus, I have shared how to setup Visual Studio to provide the quality metrics when writing code.