Help running NUnit from dos command line

nunitunit testing

I am working on an MSBuilds script to run my NUnit tests from CruiseControl.Net. _Test_DAL has three tests in it.

I am having problem getting the right dos command to run the NUnit.

Here is the command to run NUnit but it does not find any tests.

D:\CC\JCDCHelper\Source_Test_DAL\bin\Debug>"C:\Program Files\NUnit 2.4.3\bin\nunit-console" /nologo _Test_DAL.dll

Tests run: 0, Failures: 0, Not run: 0, Time: 0.047 seconds

I am able to use resharper to run the tests, so I know the tests are written correctly.

Any help would be awesome.

Best Answer

Going back answering questions i asked that were solved independantly.

We use Powershell now, but here is how we solved it in case it's useful to anyone

function Invoke-UnitTests  { 

  $NUnitExe = "C:\" + $WhereIsProgramFiles + "\NUnit 2.5.7\bin\net-2.0\nunit-console.exe"
  Show-Status "Invoke-UnitTests was called."
  Show-Status $NUnitExe

  foreach( $OneProject in ( $TestProjects))
  {
    Show-Status "Running unit test for $OneProject"

    $GetCommonDlls = "D:\CC\$AppName\Source\$AppName\_CommonDlls"
    $GetBinDlls = "D:\CC\$AppName\Source\$AppName\Bin"
    Copy-Item "$GetCommonDlls\*" "$WorkingDir" 
    Copy-Item "$GetBinDlls\*" "$WorkingDir" 

    $WorkingDir = "D:\CC\$AppName\Source\$OneProject\obj\$ReleaseOrDebug"
    $NUnitOutput = "D:\CC\$AppName\NUnit\" + $OneProject + ".xml"

    & "$NUnitExe" "$WorkingDir\$OneProject.DLL" /nologo /xml:$NUnitOutput
    if ($lastExitCode -ne 0) 
    {
        Show-Status "NUnit test Command failed for Project:$ProjectName in Application:$AppName”
        Show-Status "Command that failed: ""$NUnitExe"" ""$WorkingDir\$OneProject.DLL"" /nologo /xml:$NUnitOutput"
        Show-Error “Error: Unit test for $OneProject failed”
    }
  }

  Show-Status "All Done with Unit tests"    
}
Related Topic