Marko Apfel - Afghanistan/Belgium/Germany

Management, Architecture, Programming, QA, Coach, GIS, EAI

  Home  |   Contact  |   Syndication    |   Login
  187 Posts | 2 Stories | 201 Comments | 4 Trackbacks


Twitter | LinkedIn | Xing

Article Categories


Post Categories

Image Galleries



Enterprise Library


SQL Server


Getting the ressources

First at all download

Installation und Configuration

Unzip both archives.

xUnit part

Configure the code to use xUnit

Normally I prefer a single checkout point for my developing solution – this whole bundle I name DevTree. One of the top folders in the hierarchy of this DevTree is a lib-Folder. Beneath this folder all of the 3rd party libs which I use in my solution are located – all of them in an own folder. So I copy xunit.dll to a folder <DevTree-TopPoint>\lib\xUnit.

Now its time to use xUnit in a fixture – simply by referencing this “local” xunit.dll and using the attribute [Fact] on a test method.

xUnit-Contrib ReSharper part

As you could recognize – this test method does not get the green bubbles from ReSharper to start the test. Here comes the contrib project into play. It empowers ReSharper to run xUnit-bases test methods.

Installing the ReSharper plugin

If VS runs, close it.

You could copy the contrib stuff from the folder fitting to your ReSharper-version to

  • the ReSharper machine-wide plugin-folder
    C:\Program Files (x86)\JetBrains\ReSharper\v5.1\Bin\Plugins\xUnit Contrib ReSharper
  • or your user-sepcific plugin-folder
    %AppData%\JetBrains\ReSharper\v5.1\vs10.0\Plugins\xUnit Contrib ReSharper
    (please consider the correct VS-version in the folder-structure – vs10.0 stands for VS2010)

Maybe you must unblock this files before copying – otherwise they are not accessible from applications (right mouse > Unblock). 

Verify the runnig plugin under VS-menu ReSharper > Plugins – there should be a checked entry “ unit test provider …”

Configure external annotations (optional, but recommended)

To give ReSharper some annotations hints, first copy the xunit.xml to the external annotations folder of ReSharper.

For my version this is: C:\Program Files (x86)\JetBrains\ReSharper\v5.1\Bin\ExternalAnnotations

Importing nice live templates (optional, but recommended)

If you are an extensive user of ReSharpers LiveTemplates (and frankly – you should!) – import the Live Templates delivered with xUnit Contrib ReSharper.

There are two versions xunit-xe.xml and xunit-xa.xml. Only one of them you should use, depending on what other unit testing frameworks and Live Templates are additionally installed. I took the xe variant.

I edited the file and attributed the type of template file – so the first tag changed

  • from <TemplatesExport>
  • to <TemplatesExport  family="Live Templates">.
posted on Sunday, June 5, 2011 1:41 PM