NUnit From VS

Last week I found the best VS+NUnit add in I know until now:

It works great, however I got some errors related to the credentials of the process running your test fixtures (I was trying to find a certificate in the User Store, running the TestSuite from VS AddIn points to a different store that when you run the tests from the original NUnit)

So I keep my old macro to configure the VS Project to be launched from NUnit. (here is the VB Macro for VS.NET)



Imports System

Imports EnvDTE

Imports System.Diagnostics

Imports VSLangProj


#Region "Path to NUnit"

Public Module NUnitConstants

    Public Const BASE_PATH As String = "c:\Program Files\NUnit v2.1\bin\"   

    Public Const NUNIT_FX As String = BASE_PATH & "nunit.framework.dll"

    Public Const NUNITGUI_RUNNER As String = BASE_PATH & "nunit-gui.exe"

End Module

#End Region


Public Module TestProjectConfigurator


    Dim currentProject As VSProject


#Region "Private"

    Private Sub addReference(ByVal referencePath As String)


    End Sub

    Private Sub setDebugProperties(ByVal runnerPath As String)

        Dim assemblyName As EnvDTE.Property = CType(currentProject.Project.Properties.Item("AssemblyName"), EnvDTE.Property)

        Dim configProps As Properties = currentProject.Project.ConfigurationManager.ActiveConfiguration.Properties



        With configProps

            .Item("StartAction").Value = prjStartAction.prjStartActionProgram

            .Item("StartProgram").Value = runnerPath

            .Item("StartArguments").Value = assemblyName.Value + ".dll"

        End With

    End Sub


    Private Sub setBuildEvents()

        Dim configProps As Properties = currentProject.Project.Properties

        Dim appConfigCmd = "copy ""$(ProjectDir)App.config"" ""$(TargetDir)$(TargetFileName).config"""


        With configProps

            .Item("PreBuildEvent").Value = appConfigCmd

        End With

    End Sub

    Private Sub configureProject()




    End Sub


#End Region


    Public Sub Run()

        currentProject = DTE.ActiveSolutionProjects(0).Object


    End Sub


    Public Sub ResetConfig(ByVal nada As Object)

        currentProject = DTE.ActiveSolutionProjects(0).Object

    End Sub

End Module



Comments (4)

  1. [.NET]NUnit for Visual Studio .NET

  2. Will Ballard says:

    In the latest release, posted just now, the process for testing runs ‘as you’ instead of as a SYSTEM windows service. This should solve your security issue and match up more closely with the security context behavior of NUNIT-GUI.

  3. The following are some things that have been stacking up in my inbox that I’ve been wanting to share. Teach yourself programming in 10 years [via Chris Anderson] Rob Howard shows us how to use the provider design pattern in…

Skip to main content