Brian Genisio's House of Bilz

  Home  |   Contact  |   Syndication    |   Login
  60 Posts | 0 Stories | 111 Comments | 0 Trackbacks

News

Locations of visitors to this page

Archives

Post Categories

Who am I?

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

Feedback

# re: My ReSharper NUnit Test Templates 3/30/2009 2:10 PM dtinsley
Thanks. I downloaded these today and am using them. Good work.

# if i don't use ReSharper 3/31/2009 11:37 AM zhaorui
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

# re: My ReSharper NUnit Test Templates 3/31/2009 11:50 AM Brian Genisio
@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.

# re: My ReSharper NUnit Test Templates 4/1/2009 1:05 PM zhaorui
@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

# re: My ReSharper NUnit Test Templates 4/2/2009 10:41 AM uzivatel
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?

# re: My ReSharper NUnit Test Templates 4/2/2009 12:56 PM Brian Genisio
@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

# re: My ReSharper NUnit Test Templates 10/19/2009 8:50 AM PhillyXAML.org
Pingback from Philly XAML.org! AWESOME TOOL!

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: