NUnit macros for VS2005

I’ve been told the most current direction is to use the Unit Test framework, however I see no reason to convert or change my own methodologies since from what I’ve seen so far this new feature seemed a little buggy.  I’ve noticed some minor glitches in the way it works with source control bindings and just in general the NUnit just seems a little more simpler to get running.  I’ve sure Unit Test will get better and probably become the standard for TDD in time to come with VS.

In the meantime, I wrote a couple macros for VS2005 to help my testing workflow.  I like TestDriven.Net as an add-in to the VS IDE, I just don’t like constant checks to check on what needs to be rebuilt.  Generally, I know the dependencies myself and would like to go right into debugging oppose to these checks.  So I created a macro to automatically attach and debug to a current “nunit.exe” process.

Here’s the code below, I think a nice little enhancement would be a listbox asking which one to debug (assuming you have multiple projects currently with NUnit guis up).

Afterwards export the file to where you put all your macros and then you can add them to your IDE.

   1:  Imports System
   2:  Imports EnvDTE
   3:  Imports EnvDTE80
   4:  Imports System.Diagnostics
   5:   
   6:  Public Module AttachToNUnitGui
   7:      Sub AttachToNUnitGui()
   8:          Dim ps As EnvDTE.Processes = DTE.Debugger.LocalProcesses()
   9:          Dim process As EnvDTE.Process
  10:          Dim p As EnvDTE.Process
  11:          Dim found As Boolean = False
  12:   
  13:          For Each p In ps
  14:              If p.Name.EndsWith("nunit.exe") = True Then
  15:                  found = True
  16:                  process = p
  17:              End If
  18:          Next
  19:   
  20:   
  21:          If (found) Then
  22:              p.Attach()
  23:          Else
  24:              MsgBox("No nunit consoles running")
  25:          End If
  26:      End Sub
  27:  End Module
 
 
Currently listening to Tapes N' Tapes - Insistor
 

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Leave a Reply