I’m using GTest for C++ unit tests and have found a neat way to integrate this into Visual Studio 2010. It’s very low-tech, but works pretty well – see http://stackoverflow.com/questions/6414788/how-can-i-add-a-custom-command-to-visual-studio
- Go to Tools | External Tools… to add the command line running your GTest executable
- In the dialog, browse to your command, add the command line arguments, and be sure to select “Use Output window”
- Count up the external tools to identify the index of your new one (starting at one, not zero)
- Create/customize a toolbar – click “Add Command” and pick your new tool under category Tools, External Commands 1,2,3 … n
- Edit the name using “Modify Selection”
That’s it! Now, your command runs inside Visual Studio and writes into the output window. Even better, if there’s a test failure that includes the source location, you can double-click on it to go to that line in the editor.
Pingback: Unit Testing with GTest and GMock | musingstudio