exceptionz

Thoughts on Technology, Methodology and Programming.

ReSharper UnitTestSupport Add-in for NSpecify

Posted by Marcus Wyatt on 20 April 2007

t: I’ve never posted the link to the download, you can find it below or here.

Edit: I would suggest you rather grab a copy of the source using Subversion or Git (If you’ve been adventurous) and build the library yourself. The source supports both VS2K5 & VS2K8, so if your version of VS is 2K8, you can take advantage of the new language extension method features. If not, you’ll be able to do the plain old vanilla spec’s.

Here is the svn command:

svn co http://nspecify.svn.sourceforge.net/svnroot/nspecify nspecify

via the command line. If you are using TortoiseSVN just create a directory somewhere and use this

http://nspecify.svn.sourceforge.net/svnroot/nspecify

url in TortoiseSVN to pull down the source.

Once you’ve compiled the assemblies, you just need to copy the following

  • JetBrains.ReSharper.PowerToys.NSpecify.dll
  • JetBrains.ReSharper.PowerToys.NSpecify.xml

assemblies to the this directory:

C:\Program Files\JetBrains\ReSharper\v4.0\v.Everything\Bin\Plugins\NSpecify

If the Plugins and NSpecify directories don’t exist, create them.

————————————————————————

The NSpecify Unit test support plug-in for resharper will give you the ability to run your NSpecify specification with the ReSharper UnitRun 1.0 or ReSharper for Visual Studio 2005.

Next to declarations of test classes and single tests, ReSharper adds special icons on the left gutter of the editor window. Click these icons to run or debug tests. You can also run tests for a whole solution or project from the Visual Studio’s Solution Explorer. Just right-click the project or solution and select run or debug tests.

When you start running unit tests, ReSharper opens the Unit Test Runner window that is intended to help you with analyzing test results. Using this window, you can also run/re-run any tests. With Unit Test Runner , you can navigate from a failed test’s output to the lines that originated the exception, all with a single click.

Here is the Installation instructions:

  1. Close Visual Studio 2005.
  2. Extract the contents of archive, including the NSpecify folder, to: %ProgramFiles%\JetBrains\ReSharper\VS2005\Plugins
  3. Launch Visual Studio 2005.
  4. Open a project containing NSpecify specs.
  5. Open a spec’s file containing a functionality with Specifications. Standard ReSharper icons will appear in the left margin and allow you to run the specifications.

Known Issues – via James Kovacs

  • ReSharper Unit Test Runner icons do not appear beside Functionality Fixture and Specification Methods.
    ——————————————————————————————————-
    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 other test frameworks from the References in your spec 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.

For additional ReSharper test plug-in:

Advertisements

10 Responses to “ReSharper UnitTestSupport Add-in for NSpecify”

  1. Fabian said

    Where can it be downloaded ?

  2. Find the download here.

  3. Ian Horowitz said

    Is it possible to download source code of the add-in somewhere ?
    Where did you get the resharper sdk documentation ?

  4. I’ll post the source code as soon as I sorted my sourceforge repository. I’m trying to migrate from CSV to Subversion. I’ll post as soon as I’ve sorted out the repository and uploaded the source code. Hopefully a bit later today…

  5. Chol said

    I can’t use your good item in Resharper 2.5 in VS2005 and Nunit-2.4.2 addins..

    Do you test it?

  6. Chol said

    Resharper can’t find your addin….

  7. Hi Chol,

    For Resharper:
    1. Make sure you’re using Resharper 2.5 (Because 3.0 has changed their extensibility)
    2. Create a NSpecify folder in the “%ProgramFiles%\JetBrains\ReSharper\VS2005\Plugins” directory.
    3. Extract the JetBrains.ReSharper.UnitTestSupport.NSpecify.dll into the NSpecify directory you’ve created in step 2.
    4. Just remember that if you have a NUnit reference in your project, resharper would pick up that test library in stead.
    5. You should now be able to run the spec’s in the unit test runner from resharper.

    For NUnit:
    1. Unzip the assemblies to the %NUnit_Install_Directory%\bin\addins
    2. You’re done!

    I’ve just tested the NUnit plug-in with v2.4.0 and it works sweet. I don’t have version 2.5 of Resharper installed on my system, so I can’t really test the resharper plug-in for you and I’m still working on the Resharper 3.0 version of the plug-in.

    Hope I’ve solved your issues. Let me know…

    Maruis

  8. gkokmdam said

    Will there be a version for 3.0? (don’t really fancy going back to 2.5… 😉 )

    (thanks for the work on this, though. Funny how this social effect of renaming (in a way) will help to work more in specifying than testing…)

  9. You can grab the latest source code from the subversion repository (svn co https://nspecify.svn.sourceforge.net/svnroot/nspecify nspecify). I’ve updated the plugins about a month ago and it works with the latest version of ReSharper. Follow the following steps to get it all working:
    1. Build the source code in release mode.
    2. Browse to “C:\Documents and Setting/%User name%/Application Data/JetBrains/ReSharper/v3.0/vs8.0 (or vs9.0 if you are using vs2008). You should see a plugins folder, if you don’t create the folder.
    3. Within the plugins folder create a NSpecify folder
    4. Now copy content of the bin/release folder of the NSpecify ReSharper plugin to the folder you’ve just created in step 3.
    5. Restart VS and check that Resharper loaded the plugin correcly. (Within the Resharper menu item you’ll see the plugin submenu that will open a dialog showing all the plugins loaded by ReSharper).
    6. You should be good to go…

  10. teeter said

    teeter…

    […]ReSharper UnitTestSupport Add-in for NSpecify « exceptionz[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: