From 7f3ab36c4fa0449a74a94dd4ac01df25dd8916d4 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 10 Aug 2017 20:11:12 +0200 Subject: [PATCH] New: Run tests through powershell. (#1903) --- test.ps1 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test.ps1 diff --git a/test.ps1 b/test.ps1 new file mode 100644 index 000000000..8d9447965 --- /dev/null +++ b/test.ps1 @@ -0,0 +1,40 @@ +# Available types: +# - Unit +# - Integration +# - Automation + +param([string]$type = "Unit") + +$where = "cat != ManualTest && cat != LINUX" +$testDir = "." +$testPattern = "*Test.dll" + +$nunit = "nunit3-console.exe" +$nunitCommand = $nunit + +if (!(Get-Command $nunit -ErrorAction SilentlyContinue)) { + Write-Error "nunit3-console.exe was not found in your PATH, please install https://github.com/nunit/nunit-console/releases." + exit +} + +switch ($type) { + "unit" { + $where = $where + " && cat != IntegrationTest && cat != AutomationTest" + } + "integration" { + $where = $where + " && cat == IntegrationTest" + } + "automation" { + $where = $where + " && cat == AutomationTest" + } + Default { + Write-Error "Invalid test type specified." + exit + } +} + +$assemblies = (Get-ChildItem -Path $testDir -Filter $testPattern -Recurse -File -Name) -join " " + +$command = $nunitCommand + " --where '" + $where + "' " + $assemblies + +Invoke-Expression $command \ No newline at end of file