If you’ve ever done mstest unit testing with a Smart Device project, then you’re painfully aware of how badly Microsoft dropped the ball on this one. Debugging a unit test requires making device registry modifications, adding a call to Debugger.Break in your code, then telling Studio to Attach to Remote Process once the breakpoint has been hit. Seriously, that’s their officially published answer to how you debug a Smart Device unit test!
If you know anything about testing, you know that keeping the cycle time for a test to a minimum. The longer it takes a developer to go from “start testing” to a break point where they can step, then the less productive they’re going to be. Even worse, if the process is painful, slow and convoluted (check, check and check for Microsoft’s recommendation), they’re likely to just skip writing tests altogether.
Internally we get around this by using our own test runner which uses Reflection to load up and run tests. I’ve decided to once again give back to the community and publish this gem as part of Project Resistance (it will get checked in to the IoC Framework as well).
It does not support everything that mstest does, but it’s got enough to get you going, and I think it’s at least reasonably easy to modify if it doesn’t meet your needs. The currently supported attributes are:
It also might now be obvious how to set it up for your own app. You need to add a reference to your test assemblies (so VS will deploy them – for some stupid reason you can’t tell it to do so via the Configuration Manager) and make sure all projects are set to deploy to the same place.
As usual, if you have feedback or updates, please let me know. Submitting a patch right on one of the project portals is probably the easiest way (hint, hint).
It’s probably worth noting here that the code for this is the CFTestRunner project, and you have to pull it from the source tab on the project site (it’s not in the release download yet).