VstsUnit Plugin for ReSharper

Out of the box, JetBrains ReSharper Unit Test Runner supports NUnit and csUnit. This ReSharper plugin adds support for the Unit Testing Framework in Visual Studio Team System (VstsUnit), also known as MSTest.

N.B. The plugin will likely work with JetBrains UnitRun, but I have not taken the time to test it with UnitRun. Unfortunately you cannot have ReSharper and UnitRun installed at the same time, which means I need to set up a virtual machine with Visual Studio 2005 and JetBrains UnitRun. I have not taken the time to do this yet.

Installation

  1. Close Visual Studio 2005.
  2. Extract the contents of archive, including the VstsUnit folder, to:
    %ProgramFiles%\JetBrains\ReSharper\VS2005\Plugins
  3. Launch Visual Studio 2005.
  4. Open a project containing VstsUnit tests.
  5. Open a test file containing a TestClass with TestMethods. Standard ReSharper icons will appear in the left margin and allow you to run the unit tests.

Known Issues

ReSharper Unit Test Runner icons do not appear beside TestClass and TestMethod.
This is typically caused by having an assembly reference to another unit test framework. ReSharper Unit Test Runner (and UnitRun) only support a single unit test framework per test assembly. Remove references to NUnit.Framework, csUnit, and/or MbUnit.Framework from the References in your test project. This is a known limitation in the JetBrains' current unit test runner implementation. A plugin votes on whether the current assembly contains tests that it can run. If the plugin votes "yes", the unit test runner stops querying additional plugins. NUnit and csUnit get queried before third-party plugins.
Poor performance when running full test suite.
Unit tests are run by invoking mstest.exe and parsing the resulting xml file (.trx). The Unit Test Runner invokes the plugin once for every TestClass (aka TestFixture in NUnit terms). Unfortunately MSTest has high overhead as it copies all files to a new directory to execute tests. There is no way to turn off this behaviour in MSTest. It may be possible to run the full suite of tests and cache the results, but there are numerous problems with this approach including determining whether the cache is fresh and keeping TestClass or TestMethod runs responsive. Due to the architecture of MSTest, it is not possible (without what would likely be some truly awful System.Reflection work) to run the unit tests in-process as is done for NUnit and csUnit.
Cannot debug or profile VstsUnit tests.
I have not found a way to hook the debugger or profiler to the MSTest process. Hopefully this will be possible in a future version.

Version History

2007-03-05 1.0.0.7064 Initial Release

Acknowledgements

Thank you to the helpful folks at JetBrains for answering my questions. And thank you to Albert Weinert for making me realize that this add-in was possible in the first place when he released MbUnit support for ReSharper.

Contact

Please contact James Kovacs [jkovacs@post.harvard.edu] with suggestions, comments, or bug fixes. The official home of this utility is http://www.jameskovacs.com.

Copyright

Copyright © 2007 James Kovacs. All rights reserved.

THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.