all tests are now marked with proper tag

also, update build.psm1 to be more flexible
This commit is contained in:
James Truher 2016-07-25 17:43:28 -07:00
parent 362a807438
commit a784149b36
8 changed files with 23 additions and 10 deletions

View file

@ -467,11 +467,24 @@ function Get-PSOutput {
function Start-PSPester {
[CmdletBinding()]param(
[string]$Flags = "-ExcludeTag 'Slow' -Tag 'CI' -EnableExit -OutputFile pester-tests.xml -OutputFormat NUnitXml",
[string]$OutputFormat = "NUnitXml",
[string]$OutputFile = "pester-tests.xml",
[switch]$DisableExit,
[string[]]$ExcludeTag = "Slow",
[string[]]$Tag = "CI",
[string]$Path = "$PSScriptRoot/test/powershell"
)
$tagString = "-outputFormat ${OutputFormat} -outputFile ${outputFile} "
if ( ! $DisableExit ) { $tagString += " -EnableExit" }
if ( $ExcludeTag ) { $tagString += " -ExcludeTag @('" + (${ExcludeTag} -join "','") + "')" }
if ( $Tag ) { $tagString += " -Tag @('" + (${Tag} -join "','") + "')" }
& (Get-PSOutput) -noprofile -c "Import-Module '$PSHOME/Modules/Pester'; Invoke-Pester $Flags $Path"
$powershell = get-psoutput
$psdir = [io.path]::GetDirectoryName($powershell)
$moduleDir = [io.path]::Combine($psdir,"Modules","Pester")
Write-Verbose "Import-Module '$moduleDir'; Invoke-Pester $tagString $Path"
& (Get-PSOutput) -noprofile -c "Import-Module '$moduleDir'; Invoke-Pester $tagString $Path"
if ($LASTEXITCODE -ne 0) {
throw "$LASTEXITCODE Pester tests failed"
}

View file

@ -1,4 +1,4 @@
Describe "Configuration file locations" -tags "CI" {
Describe "Configuration file locations" -tags "CI","Slow" {
BeforeAll {
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"

View file

@ -1,4 +1,4 @@
Describe "Read-Host" -Tags "CI" {
Describe "Read-Host" -Tags "Slow","Feature" {
Context "[Console]::ReadKey() implementation on non-Windows" {
BeforeAll {
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"

View file

@ -1,4 +1,4 @@
Describe 'Exceptions flow for classes' -Tags "DRT" {
Describe 'Exceptions flow for classes' -Tags "CI" {
$canaryHashtable = @{}

View file

@ -98,7 +98,7 @@ function Test-Completions
{
foreach ($test in $TestCases)
{
Describe $test.Description {
Describe $test.Description -Tags "CI" {
$hash = $Test.TestInput
$results = Get-Completions @hash

View file

@ -18,7 +18,7 @@ $source = "http://www.nuget.org/api/v2/"
# Actual Tests:
Describe "Get-package" -Tags @('BVT', 'DRT'){
Describe "Get-package" -Tags "Feature" {
# make sure that packagemanagement is loaded
It "EXPECTED: Get-package accepts array of strings for -providername parameter" -Skip {
$x = (get-package -providername Programs,Msi)

View file

@ -72,7 +72,7 @@ Describe "get-packageprovider" -Tags "CI" {
}
Describe "Get-PackageProvider with list" Tags "CI" {
Describe "Get-PackageProvider with list" -Tags "CI" {
It "lists package providers installed" {
$x = (Get-PackageProvider).Count -gt 1 | should be $true

View file

@ -1,4 +1,4 @@
Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)" {
Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)" -Tags "CI" {
BeforeAll {
$functionDefinitionFile = Join-Path -Path $TestDrive -ChildPath "functionDefinition.ps1"
$functionDefinition = @'
@ -825,4 +825,4 @@ Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)"
$_.FullyQualifiedErrorId | should be "ParseException"
}
}
}
}