Skip to content

Instantly share code, notes, and snippets.

@jincod
Last active January 29, 2018 17:47
Show Gist options
  • Save jincod/4f183172e46a64179a12 to your computer and use it in GitHub Desktop.
Save jincod/4f183172e46a64179a12 to your computer and use it in GitHub Desktop.
Run NUnit3 tests from powershell
$ProjectDir = "."
$PackagesDir = "$ProjectDir\packages"
$OutDir = "$ProjectDir\bin\Debug"
# Install NUnit Test Runner
$nuget = "$ProjectDir\.nuget\nuget.exe"
& $nuget install NUnit.Runners -ExcludeVersion -o $PackagesDir
# Set nunit path test runner
$nunit = "$ProjectDir\packages\NUnit.ConsoleRunner\tools\nunit3-console.exe"
#Find tests in OutDir
$tests = (Get-ChildItem $OutDir -Recurse -Include *Tests.dll)
# Run NUnit3 tests
& $nunit $tests --noheader --framework=net-4.5 --work=$OutDir
@jincod
Copy link
Author

jincod commented Mar 24, 2016

# Run NUnit2 tests
& $nunit /noshadow /framework:"net-4.0" /xml:"$OutDir\Tests.nunit.xml" $tests

@nadvolod
Copy link

nadvolod commented Jun 2, 2017

Thanks for this. How can i use this to pass in a command like: --where "name == TCID65691". I keep trying to append it to that last line but it says that nunit doesnt recognize this command. However, works fine in the console.

@nadvolod
Copy link

To answer my question above, this is the line of code:
& $NUnitConsoleExecutablePath $automationdll --where="cat==smoke"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment