Geeks With Blogs

News Locations of visitors to this page
Brian Genisio's House of Bilz
Shout it

Much like my previous post about what I use for testing in Silverlight, I was recently asked on Twitter for my ReSharper NUnit templates.  I am posting them here if anyone finds them useful.

Basically, I write a LOT of tests every day.  These templates allow me to write tests faster.

New Test File Template

This file template adds a new “Test” target when you say tell Visual Studio to create a new file from template.  It populates your file with the correct namespaces and decorations to get you started.

Coding Templates

These are shortcuts that create new tests, setups, teardowns or assertions.  You just type the shortcut, hit tab, and the method or lines are created for you with your mouse cursor in the next place to type.  The shortcuts are:

  • test – Create a new [Test] method
  • setup – Create a [SetUp] method
  • teardown – Create a new [TearDown] method
  • ise – Assert that condition is equal to value
  • ist – Assert that condition is true
  • isf – Assert that condition is false
  • isn – Assert that condition is null
  • isnn – Assert that condition is not null

Download my ReSharper 4 NUnit templates.

Posted on Sunday, March 29, 2009 8:48 PM | Back to top


Comments on this post: My ReSharper NUnit Test Templates

# re: My ReSharper NUnit Test Templates
Requesting Gravatar...
Thanks. I downloaded these today and am using them. Good work.
Left by dtinsley on Mar 30, 2009 2:10 PM

# if i don't use ReSharper
Requesting Gravatar...
Thanks for share.
I like this NUnit Template,
but if i don't use ReSharper, how do i use this template ?
i will try do it tomorrow
Left by zhaorui on Mar 31, 2009 11:37 AM

# re: My ReSharper NUnit Test Templates
Requesting Gravatar...
@zhaorui:

These are specifically meant for ReSharper, so if you don't use ReSharper, you are out of luck.

You can probably use Visual Studio code snippets to do the same thing, but I find the ReSharper "Templates" to be much more powerful than code snippets.

For that matter, I find ReSharper to make everything in Visual Studio better. I cannot live without ReSharper now that I use it. It is that powerful.
Left by Brian Genisio on Mar 31, 2009 11:50 AM

# re: My ReSharper NUnit Test Templates
Requesting Gravatar...
@Brian Genisio

Thanks for your reply.

I get a NUnit item template by using Template Export function in Visual Studio 2008, But it is some problem.

Maybe I should try ReSharper
Left by zhaorui on Apr 01, 2009 1:05 PM

# re: My ReSharper NUnit Test Templates
Requesting Gravatar...
good work m8,

too bad we're using MBUnit (which is better imo)...
haven't you considered switching from old-non-evolving NUnit? =D

but there are many similar things so the changes would be minor...

does it work in R# 4.5 beta?
Left by uzivatel on Apr 02, 2009 10:41 AM

# re: My ReSharper NUnit Test Templates
Requesting Gravatar...
@uzivatel

I am sticking with NUnit for one real reason... it does everything I need it to and I don't see any reason to switch my thousands of tests over to a new framework.

When you say old-non-evolving, what do you mean by that? There are quite a few new features in NUnit 2.5... what value does MBUnit give you over NU2.5? Just curious.

As far as the templates go, I would assume that they can be very easily modified to support MBUnit... it is really just attribute names, right? Just import them, open them up in the template editor, and change them for your tool. Should be pretty straight forward.

As for 4.5 Beta, I am not using it yet, but I would be shocked and disappointed if they don't work in 4.5. If it turns out that they don't, I will update them and put them back up on this blog as soon as I upgrade to 4.5.

Thanks!
Brian
Left by Brian Genisio on Apr 02, 2009 12:56 PM

# re: My ReSharper NUnit Test Templates
Requesting Gravatar...
Pingback from Philly XAML.org! AWESOME TOOL!
Left by PhillyXAML.org on Oct 19, 2009 8:50 AM

# re: My ReSharper NUnit Test Templates
Requesting Gravatar...
Thanks. Good work!
Left by Lavr on Feb 23, 2010 3:50 AM

Your comment:
 (will show your gravatar)


Copyright © Brian Genisio's House Of Bilz | Powered by: GeeksWithBlogs.net