How To Build an NUnit Addin

Standard

Since version 2.2.x of NUnit it was possible to build your own core extensions, but this feature was experimental. With the latest release Addins are officially supported. Core extensions can customize NUnit’s internal behavior such as the creation of tests and their execution.

Writing an Addin

An Addin needs to implement the interface NUnit.Core.Extensibility.IAddin, which can be found in the assembly “nunit.core.interfaces”. Additionally the NUnit.Core.Extensibility.NUnitAddinAttribute must be applied to your Addin class. The attribute parameters Name and Description represent the name of the extension and a description of what it does. You can leave ExtensionType at its default value (ExtensionType.Core), because NUnit supports only core extensions by now. The interface NUnit.Core.Extensibility.IAddin has only one method which is called Install. Your Addin class will install extensions at certain extension points, places where the NUnit functionality can be extended. To locate such extension points your Addin class uses the extension host, which is passed as parameter. The Install method returns true when your Addin was able to install your extensions, otherwise it returns false. A minimal Addin would look like this:

    using System;
    using NUnit.Core.Extensions;
    
    [NUnitAddin(Name=”MyAddin”,
        Description=”This Addin does not do anything.”)]
    public class MyAddin : IAddin
    {
      public bool Install(IExtensionHost host)
      {
        return true;
      }
    }

How to Install an Addin

After compiling the Addin copy the assembly to the bin/addins directory relative to the NUnit install directory. Start the NUnit GUI and you should see your Addin listed under Tools -> Addins…: MyAddin does not do anything useful. The next time I’ll show you how to write a test decorator.

myfirstaddin

118 thoughts on “How To Build an NUnit Addin

  1. After I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a remark is added I get four emails with the identical comment. Is there any manner you’ll be able to remove me from that service? Thanks!

  2. hi!,I like your writing so so much! proportion we keep in touch more approximately your post on AOL? I require an expert in this house to resolve my problem. May be that’s you! Looking forward to see you.

  3. Wow, superb blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is magnificent, as well as the content!

  4. I do not even know how I ended up here, but I thought this post was good.
    I don’t know who you are but definitely you’re going to a famous blogger if you aren’t already 😉 Cheers!

  5. Hey there! I’m at work browsing your blog from my new iphone 3gs!
    Just wanted to say I love reading through your blog and look forward to all your
    posts! Keep up the excellent work!

  6. Aw, this was a really nice post. In idea I would like to put in writing like this moreover – taking time and actual effort to make a very good article… however what can I say… I procrastinate alot and not at all seem to get one thing done.

  7. I know this if off topic but I’m looking into starting my own blog and was curious what all
    is required to get set up? I’m assuming having a blog like yours would cost a pretty
    penny? I’m not very internet smart so I’m not 100% sure.
    Any tips or advice would be greatly appreciated.
    Appreciate it

  8. Hi there, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam comments? If so how do you stop it, any plugin or anything you can advise? I get so much lately it’s driving me mad so any support is very much appreciated.

  9. Attractive portion of content. I just stumbled upon your website and in accession capital to say that I get in fact loved account your blog posts. Any way I’ll be subscribing to your feeds and even I success you get entry to constantly rapidly.

  10. When I originally commented I clicked the -Notify me when new comments are added- checkbox and now every time a remark is added I get four emails with the identical comment. Is there any means you can remove me from that service? Thanks!

  11. You really make it seem so easy with your presentation but I find this topic to be actually one thing that I feel I might never understand. It kind of feels too complicated and very broad for me. I am looking forward for your next post, I’ll attempt to get the dangle of it!

  12. I’m amazed, I must say. Rarely do I encounter a blog that’s both educative and interesting, and let me tell you, you’ve hit the nail on the head.
    The issue is an issue that too few folks are speaking intelligently about.
    I’m very happy that I found this during my search
    for something relating to this.

  13. I’ve learn some just right stuff here. Certainly value bookmarking for revisiting.
    I wonder how so much effort you set to make the sort
    of fantastic informative web site.

  14. The other day, while I was at work, my cousin stole my apple
    ipad and tested to see if it can survive a thirty foot
    drop, just so she can be a youtube sensation. My iPad is now destroyed and she
    has 83 views. I know this is completely off
    topic but I had to share it with someone!

  15. naturally like your web-site however you need to take a look at the spelling on several of your posts.
    Several of them are rife with spelling problems and I find it very bothersome to tell the reality on the other hand I will surely
    come back again.

  16. Hello! This is kind of off topic but I need some advice from an established blog. Is it very hard to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about creating my own but I’m not sure where to start. Do you have any ideas or suggestions? Many thanks

  17. I’m really inspired together with your writing abilities and also with the layout to your weblog. Is this a paid subject matter or did you customize it yourself? Either way keep up the excellent high quality writing, it is uncommon to see a nice weblog like this one nowadays..

  18. My partner and I stumbled over here coming from a different website and thought I might check things out.
    I like what I see so i am just following you. Look forward to looking at your
    web page again.

Leave a Reply

Your email address will not be published.