I'm in the process of developing a Visual Studio add-in for a project at work, and have found debugging and testing it to be pretty tedious. So far, it appears to require the launching of a second instance of Visual Studio and manual execution of the add-in code. What techniques and/or tools are available for automating this sort of add-in testing?
views:
47answers:
2The only way your add-in will be testable is if you design it to be testable. Typcially when writing a Visual Studio Add-In / Package / MEF component I divide my code into 2 projects.
- Actual Core Engine which has little or no dependency on Visual Studio
- The actual Add-In which uses the Bridge pattern to expose the core engine
#1 is clearly testable by normal mechanisms and should represent the majority of your code.
#2 is a little more unwieldy to test but not terribly so. Visual Studio's API is entirely interface based and hence can be easily mocked. It takes a bit of leg work but it can certainly be done to enough of an extent to test your code.
There are dedicated single user testing tools out there, like SilkTest and TestPartner, but they tend to be very expensive, so I suggest you check out Automise, which can be used to automate repetitive tasks, and has a 30 day free trial. It comes from the same people who do the excellent FinalBuilder build tool.