All posts tagged 'nit-Testing'

.NET Musings

CodeMash 2.0.1.0 Rocked

Another CodeMash is in the books.  Unfortunately, I was terribly ill through most of it, and didn’t get nearly as much out of it as I would have liked.  I did get through my sessions reasonably well (I talk two 4 hour T/BDD workshops at the pre-compiler) – I really appreciate the patience the attendees had with my voice dying and the lack of a working microphone in our room.

The completed project is located on my Samples and Presentations Page.  For the other tools and goodies provided, see below.  Hope you enjoyed the session!

ReSharper Templates

Included in the “Files” directory under the precon setup zip file are two xml files containing some T/BDD Live Templates and File Templates.  To import them into R#, goto ReSharper –> Live Templates… This will bring up the Templates Explorer. 

Live Templates

Select the Live Templates tab in Templates Explorer, then click on the Import Button, and select “ResharperLiveTemplates.xml”.  This will add several helpful templates to use while working with open files. 

File Templates

Select the File Templates tab in Templates Explorer, then click on the Import Button, and select “ResharperFileTemplates.xml”.  This will add two helpful templates to use for adding either a Specification file or MbUnit Test Fixture to the current project.

Test ReName Macro

I’ve included two Visual Studio macros, the first of which will rename a test to include underscores.  This is detailed in another post on this blog located here.

Cancel Failed Build Macro

The other macro will cancel a build as soon as a project fails.  This is handy so you don’t receive all of the additional compile errors that are not helpful when trying to track down the original exception that caused the first project failure. This ties into the IDE eventing system, and is described in detail on Steve Dunn’s blog here.

Copy Files Post Build Event

The batch code for using RoboCopy to copy all of the relevant files from the build directories to a common deployment location is in the file CopyFilesPostBuild.txt.  This process is detailed on my blog here.

Creating MSpec Report from Visual Studio

To create the MSpec report from Visual Studio, place the “CreateReport.cmd” in the same folder where all of the MSpec files are located.  Remove the path from the first line of the command file so the line reads (I had the original hard coded to my personal path which is not necessary):

MSpec.exe --html %1 %2

The first parameter passed in is the name of the HTML file that will be created, the second parameter is the project that contains the MSpec concerns to report.

To add the external tool to Visual Studio, goto Tools -> External Tools...which will bring up the External Tools dialog.  Click Add, specify:

  • Title: I selected "Create MSpec Report",
  • Command: Enter the fully qualified path for the command file (the batch file CreateReport.cmd),
  • Arguments: The Arguments need to be specified as follows:
$(SolutionDir)$(TargetName).html $(BinDir)$(TargetName)$(TargetExt)

This will create an HTML MSpec report in the solution directory with the name <ProjectWithTheConcerns>.html.  The second parameter specifies the target file that contains the Concerns.

  • Initial Directory: Specify the directory where the MSpec files (and the command file) are located.

Why the command file?  Because I like putting a pause command at the end so that I can read the output (such as errors, etc).

There it is.  In my next post I will outline the methodology we covered in the pre-compiler for turning sketchy requirements into the level of detail that developers need while still including the business in the process.

Let me know if you have any questions or concerns, and as always,

Happy Coding!

Managed Windows Shared Hosting by OrcsWeb