exceptionz

Thoughts on Technology, Methodology and Programming.

Archive for April, 2007

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

Posted in BDD, Development, Software, TDD | 10 Comments »

NUnit addin for NSpecify

Posted by Marcus Wyatt on 19 April 2007

I’ve completed the NUnit addin and you can now download the addin and run your NSpecify specs from within the NUnit Gui or command line. Download the assemblies here.

To install do the following:
1. Unzip the assemblies to the %NUnit_Install_Directory%\bin\addins
2. You’re done!
3. Enjoy!!

Note: This addin will only work with NUnit v2.4.0.0 or higher.

Technorati Tags: , ,

Powered by ScribeFire.

Posted in BDD, Development, Software, TDD | Leave a Comment »

NSpecify.Framwork Beta 1 release

Posted by Marcus Wyatt on 19 April 2007

I have a new version of the NSpecify framework ready for download. With beta 1 release I have completely removed any references to the NUnit libraries and completed some of the specifications that was still outstanding. At the moment I’m working on a Resharper, TestDriven.NET and NUnit plug-ins.

The download for the framework is here and you can find more information about NSpedify here.

Enjoy….

Technorati Tags: , ,

Powered by ScribeFire.

Posted in BDD, Development, TDD | Leave a Comment »

How to get rid of an ampersand in the query string

Posted by Marcus Wyatt on 10 April 2007

If you’ve worked on web applications, you probably know that using the query string to pass data is important. But how would you handle a string that contains an ampersand in the query string. Here is an example:

string title = “Jack & Jill”;

string category = “Nursery Rhyme”;

Response.Redirect(“Books.aspx?title=” + title + “&category=” + category);

If you try to run the code example above the title query parameter will only contain ‘Jack’. This is a problem, so how do you escape the ampersand in the title variable. You could use the escape function in Javascript.

window.escape("Jack & Jill");

Another option is to use the HttpUtility.UrlEncode method:

string title = HttpUtility.UrlEncode(“Jack & Jill”, Encoding.ASCII);

string category = “Nursery Rhyme”;

Response.Redirect(“loadNurseryRhyme?title=” + title + “&category=” + category);

The string ‘Jack & Jill’ is now escaped as follows ‘Jack+%26+Jill’ and you don’t lose any information in your query string.

Enjoy!

Technorati Tags:

Powered by ScribeFire.

Posted in Development | 3 Comments »