mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Merge pull request #1526 from PowerShell/jameswtruher/TagPesterTests
Jameswtruher/tag pester tests
This commit is contained in:
commit
3ecac72baf
153 files changed
+344
-277
No files matched your search
+7
-1
@@ -22,6 +22,12 @@ install:
|
||||
build_script:
|
||||
- ps: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
# check to be sure our test tags are correct
|
||||
$result = Get-PesterTag
|
||||
if ( $result.Result -ne "Pass" ) {
|
||||
$result.Warnings
|
||||
throw "Tags must be CI, Feature, Scenario, or Slow"
|
||||
}
|
||||
Start-PSBuild -Publish
|
||||
Start-PSBuild -FullCLR
|
||||
|
||||
@@ -34,7 +40,7 @@ test_script:
|
||||
$env:CoreOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -Publish))
|
||||
Write-Host -Foreground Green 'Run CoreCLR tests'
|
||||
$testResultsFile = "$pwd\TestsResults.xml"
|
||||
& ("$env:CoreOutput\powershell.exe") -noprofile -noninteractive -c "Invoke-Pester test/powershell -ExcludeTag 'Slow' -OutputFormat NUnitXml -OutputFile $testResultsFile"
|
||||
& ("$env:CoreOutput\powershell.exe") -noprofile -noninteractive -c "Invoke-Pester test/powershell -Tag 'CI' -ExcludeTag 'Slow' -OutputFormat NUnitXml -OutputFile $testResultsFile"
|
||||
|
||||
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
|
||||
#
|
||||
|
||||
+63
-2
@@ -465,13 +465,74 @@ function Get-PSOutput {
|
||||
}
|
||||
|
||||
|
||||
function Get-PesterTag {
|
||||
param ( [Parameter(Position=0)][string]$testbase = "$PSScriptRoot/test/powershell" )
|
||||
$alltags = @{}
|
||||
$warnings = @()
|
||||
|
||||
get-childitem -Recurse $testbase -File |?{$_.name -match "tests.ps1"}| %{
|
||||
$fullname = $_.fullname
|
||||
$tok = $err = $null
|
||||
$ast = [System.Management.Automation.Language.Parser]::ParseFile($FullName, [ref]$tok,[ref]$err)
|
||||
$des = $ast.FindAll({$args[0] -is "System.Management.Automation.Language.CommandAst" -and $args[0].CommandElements[0].Value -eq "Describe"},$true)
|
||||
foreach( $describe in $des) {
|
||||
$elements = $describe.CommandElements
|
||||
$lineno = $elements[0].Extent.StartLineNumber
|
||||
$foundTag = $false
|
||||
for ( $i = 0; $i -lt $elements.Count; $i++) {
|
||||
if ( $elements[$i].extent.text -match "^-t" ) {
|
||||
$vAst = $elements[$i+1]
|
||||
if ( $vAst.FindAll({$args[0] -is "System.Management.Automation.Language.VariableExpressionAst"},$true) ) {
|
||||
$warnings += "TAGS must be static strings, error in ${fullname}, line $lineno"
|
||||
}
|
||||
$values = $vAst.FindAll({$args[0] -is "System.Management.Automation.Language.StringConstantExpressionAst"},$true).Value
|
||||
$values | %{
|
||||
if ( $_ -notmatch "CI|FEATURE|SCENARIO|SLOW" ) {
|
||||
$warnings += "${fullname} includes improper tag '$_', line '$lineno'"
|
||||
}
|
||||
$alltags[$_]++
|
||||
}
|
||||
$foundTag = $true
|
||||
}
|
||||
}
|
||||
if ( ! $foundTag ) {
|
||||
$warnings += "${fullname} does not include -Tag in Describe, line '$lineno'"
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $Warnings.Count -gt 0 ) {
|
||||
$alltags['Result'] = "Fail"
|
||||
}
|
||||
else {
|
||||
$alltags['Result'] = "Pass"
|
||||
}
|
||||
$alltags['Warnings'] = $warnings
|
||||
$o = [pscustomobject]$alltags
|
||||
$o.psobject.TypeNames.Add("DescribeTagsInUse")
|
||||
$o
|
||||
}
|
||||
|
||||
function Start-PSPester {
|
||||
[CmdletBinding()]param(
|
||||
[string]$Flags = "-ExcludeTag 'Slow' -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 -and ($ExcludeTag -ne "")) { $tagString += " -ExcludeTag @('" + (${ExcludeTag} -join "','") + "')" }
|
||||
if ( $Tag ) { $tagString += " -Tag @('" + (${Tag} -join "','") + "')" }
|
||||
|
||||
& (Get-PSOutput) -noprofile -c "Import-Module '$PSScriptRoot/src/Modules/Shared/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"
|
||||
$powershellexe = get-psoutput
|
||||
& $powershell -noprofile -c "Import-Module '$moduleDir'; Invoke-Pester $tagString $Path"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "$LASTEXITCODE Pester tests failed"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Configuration file locations" {
|
||||
Describe "Configuration file locations" -tags "CI","Slow" {
|
||||
|
||||
BeforeAll {
|
||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using namespace System.Diagnostics
|
||||
|
||||
Describe "ConsoleHost unit tests" {
|
||||
Describe "ConsoleHost unit tests" -tags "Feature" {
|
||||
|
||||
BeforeAll {
|
||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "PSVersionTable" {
|
||||
Describe "PSVersionTable" -Tags "CI" {
|
||||
It "Should have version table entries" {
|
||||
$PSVersionTable.Count | Should Be 9
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Read-Host" {
|
||||
Describe "Read-Host" -Tags "Slow","Feature" {
|
||||
Context "[Console]::ReadKey() implementation on non-Windows" {
|
||||
BeforeAll {
|
||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Issue#682 - [system.manage<tab>] should work" {
|
||||
Describe "Issue#682 - [system.manage<tab>] should work" -Tags "CI" {
|
||||
|
||||
It "[system.manage<tab>" {
|
||||
$result = TabExpansion2 -inputScript "[system.manage" -cursorColumn "[system.manage".Length
|
||||
|
||||
@@ -649,7 +649,7 @@ function test-it([EE]$ee){$ee}
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Type building' -Tags "DRT" {
|
||||
Describe 'Type building' -Tags "CI" {
|
||||
It 'should build the type only once for scriptblock' {
|
||||
$a = $null
|
||||
1..10 | % {
|
||||
@@ -671,7 +671,7 @@ Describe 'Type building' -Tags "DRT" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'RuntimeType created for TypeDefinitionAst' {
|
||||
Describe 'RuntimeType created for TypeDefinitionAst' -Tags "CI" {
|
||||
|
||||
It 'can make cast to the right RuntimeType in two different contexts' -pending {
|
||||
|
||||
@@ -707,7 +707,7 @@ class Derived : Base
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'TypeTable lookups' {
|
||||
Describe 'TypeTable lookups' -Tags "CI" {
|
||||
|
||||
Context 'Call methods from a different thread' {
|
||||
$b = [powershell]::Create().AddScript(
|
||||
@@ -733,7 +733,7 @@ class B
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Protected method access' {
|
||||
Describe 'Protected method access' -Tags "CI" {
|
||||
|
||||
Add-Type @'
|
||||
namespace Foo
|
||||
@@ -816,7 +816,7 @@ return [A]::new()
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'variable analysis' {
|
||||
Describe 'variable analysis' -Tags "CI" {
|
||||
It 'can specify type construct on the local variables' {
|
||||
class A { [string] getFoo() { return 'foo'} }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe 'Break statements with classes' -Tags "DRT" {
|
||||
Describe 'Break statements with classes' -Tags "CI" {
|
||||
|
||||
function Get-Errors([string]$sourceCode) {
|
||||
$tokens = $null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe 'Exceptions flow for classes' -Tags "DRT" {
|
||||
Describe 'Exceptions flow for classes' -Tags "CI" {
|
||||
|
||||
$canaryHashtable = @{}
|
||||
|
||||
@@ -224,7 +224,7 @@ $canaryHashtable['canary'] += 100
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Exception error position" -Tags "DRT" {
|
||||
Describe "Exception error position" -Tags "CI" {
|
||||
class MSFT_3090412
|
||||
{
|
||||
static f1() { [MSFT_3090412]::bar = 42 }
|
||||
@@ -270,7 +270,7 @@ Describe "Exception error position" -Tags "DRT" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Exception from initializer" -Tags "DRT" {
|
||||
Describe "Exception from initializer" -Tags "CI" {
|
||||
class MSFT_6397334a
|
||||
{
|
||||
[int]$a = "zz"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe 'Misc Test' -Tags "innerloop", "DRT" {
|
||||
Describe 'Misc Test' -Tags "CI" {
|
||||
|
||||
Context 'Where' {
|
||||
class C1 {
|
||||
@@ -43,4 +43,4 @@ Describe 'Misc Test' -Tags "innerloop", "DRT" {
|
||||
[C1]::new().Bar() | should be "1;2;3;"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
Describe 'PSModuleInfo.GetExportedTypeDefinitions()' {
|
||||
Describe 'PSModuleInfo.GetExportedTypeDefinitions()' -Tags "CI" {
|
||||
It "doesn't throw for any module" {
|
||||
$discard = Get-Module -ListAvailable | % { $_.GetExportedTypeDefinitions() }
|
||||
$true | Should Be $true # we only verify that we didn't throw. This line contains a dummy Should to make pester happy.
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'use of a module from two runspaces' {
|
||||
Describe 'use of a module from two runspaces' -Tags "CI" {
|
||||
function New-TestModule {
|
||||
param(
|
||||
[string]$Name,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe 'NestedModules' -Tags "DRT" {
|
||||
Describe 'NestedModules' -Tags "CI" {
|
||||
|
||||
Import-Module $PSScriptRoot\..\LanguageTestSupport.psm1
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Import-Module $PSScriptRoot\..\LanguageTestSupport.psm1
|
||||
|
||||
Describe 'Classes inheritance syntax' -Tags "DRT" {
|
||||
Describe 'Classes inheritance syntax' -Tags "CI" {
|
||||
|
||||
It 'Base types' {
|
||||
class C1 {}
|
||||
@@ -81,7 +81,7 @@ Describe 'Classes inheritance syntax' -Tags "DRT" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Classes inheritance syntax errors' -Tags "DRT" {
|
||||
Describe 'Classes inheritance syntax errors' -Tags "CI" {
|
||||
ShouldBeParseError "class A : NonExistingClass {}" TypeNotFound 10
|
||||
ShouldBeParseError "class A : {}" TypeNameExpected 9
|
||||
ShouldBeParseError "class A {}; class B : A, {}" TypeNameExpected 24
|
||||
@@ -118,7 +118,7 @@ Describe 'Classes inheritance syntax errors' -Tags "DRT" {
|
||||
ShouldBeParseError "class A : C {}; class B : A {}; class C : B {}" TypeNotFound 10 -SkipAndCheckRuntimeError
|
||||
}
|
||||
|
||||
Describe 'Classes methods with inheritance' -Tags "DRT" {
|
||||
Describe 'Classes methods with inheritance' -Tags "CI" {
|
||||
|
||||
Context 'Method calls' {
|
||||
|
||||
@@ -367,7 +367,7 @@ Describe 'Classes methods with inheritance' -Tags "DRT" {
|
||||
}
|
||||
|
||||
|
||||
Describe 'Classes inheritance ctors syntax errors' -Tags "DRT" {
|
||||
Describe 'Classes inheritance ctors syntax errors' -Tags "CI" {
|
||||
|
||||
#DotNet.Interface.NotImplemented
|
||||
ShouldBeParseError "class MyComparable : system.IComparable {}" TypeCreationError 0 -SkipAndCheckRuntimeError
|
||||
@@ -382,7 +382,7 @@ Describe 'Classes inheritance ctors syntax errors' -Tags "DRT" {
|
||||
ShouldBeParseError 'class A { A([int]$a) {} }; class B : A {}' BaseClassNoDefaultCtor 27 -SkipAndCheckRuntimeError
|
||||
}
|
||||
|
||||
Describe 'Classes inheritance ctors' -Tags "DRT" {
|
||||
Describe 'Classes inheritance ctors' -Tags "CI" {
|
||||
|
||||
It 'can call base ctor' {
|
||||
class A {
|
||||
@@ -508,7 +508,7 @@ Describe 'Classes inheritance ctors' -Tags "DRT" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Type creation' {
|
||||
Describe 'Type creation' -Tags "CI" {
|
||||
It 'can call super-class methods sequentially' {
|
||||
$sb = [scriptblock]::Create(@'
|
||||
class Base
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (c) Microsoft Corporation, 2015
|
||||
#
|
||||
|
||||
Describe 'enums' -Tags "DRT" {
|
||||
Describe 'enums' -Tags "CI" {
|
||||
|
||||
Context 'basic enums' {
|
||||
enum E1
|
||||
@@ -73,7 +73,7 @@ Describe 'enums' -Tags "DRT" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Basic enum errors' -Tags "DRT" {
|
||||
Describe 'Basic enum errors' -Tags "CI" {
|
||||
|
||||
Import-Module $PSScriptRoot\..\LanguageTestSupport.psm1
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "DotNetAPI" {
|
||||
Describe "DotNetAPI" -Tags "CI" {
|
||||
$posh_E = 2.718281828459045
|
||||
$posh_pi = 3.14159265358979
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe ".NET class interoperability" {
|
||||
Describe ".NET class interoperability" -Tags "CI" {
|
||||
It "Should access types in System.Console" {
|
||||
[System.Console]::TreatControlCAsInput | Should Be $false
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "ComparisonOperator" {
|
||||
Describe "ComparisonOperator" -tag "CI" {
|
||||
It "Should be $true for 1 -lt 2" {
|
||||
1 -lt 2 | Should Be $true
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Namespace System.Management.Automation.Language
|
||||
Describe "The SafeGetValue method on AST returns safe values" -Tags "DRT" {
|
||||
Describe "The SafeGetValue method on AST returns safe values" -Tags "CI" {
|
||||
It "A hashtable is returned from a HashtableAst" {
|
||||
$HashtableAstType = [HashtableAst]
|
||||
$HtAst = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
Describe 'Automatic variable $input' {
|
||||
Describe 'Automatic variable $input' -Tags "CI" {
|
||||
It '$input Type should be enumerator' {
|
||||
function from_begin { [cmdletbinding()]param() begin { Write-Output -NoEnumerate $input } }
|
||||
function from_process { [cmdletbinding()]param() process { Write-Output -NoEnumerate $input } }
|
||||
|
||||
@@ -32,7 +32,7 @@ $typeDefinition += "`n}"
|
||||
Write-Verbose $typeDefinition
|
||||
Add-Type $typeDefinition
|
||||
|
||||
Describe "bnot on enums" -Tags "DRT" {
|
||||
Describe "bnot on enums" -Tags "CI" {
|
||||
foreach ($enumType in [type[]]$enumTypeNames)
|
||||
{
|
||||
Context $enumType.Name {
|
||||
@@ -63,7 +63,7 @@ Describe "bnot on enums" -Tags "DRT" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "bnot on integral types" -Tags "DRT" {
|
||||
Describe "bnot on integral types" -Tags "CI" {
|
||||
foreach ($baseType in $baseTypes.Keys)
|
||||
{
|
||||
Context $baseType.Name {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe 'conversion syntax' -Tags "innerloop", "DRT" {
|
||||
Describe 'conversion syntax' -Tags "CI" {
|
||||
# these test suite covers ([<type>]<expression>).<method>() syntax.
|
||||
# it mixes two purposes: casting and super-class method calls.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Redirection operator now supports encoding changes" {
|
||||
Describe "Redirection operator now supports encoding changes" -Tags "CI" {
|
||||
BeforeAll {
|
||||
$asciiString = "abc"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
Describe "Type accelerators" -Tags "DRT" {
|
||||
Describe "Type accelerators" -Tags "CI" {
|
||||
$TypeAcceleratorsType = [psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")
|
||||
|
||||
$TypeAccelerators = $TypeAcceleratorsType::Get
|
||||
|
||||
@@ -61,7 +61,7 @@ class C2
|
||||
#[ElapsedEventHandler][CompilerGeneratedAttribute()]$EventHandler
|
||||
}
|
||||
|
||||
Describe "Using Namespace" -Tags "DRT" {
|
||||
Describe "Using Namespace" -Tags "CI" {
|
||||
It "Type literals w/ using namespace" {
|
||||
[Thread].FullName | Should Be System.Threading.Thread
|
||||
[Int32].FullName | Should Be System.Int32
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
## Script debugging tests
|
||||
##
|
||||
|
||||
Describe "Breakpoints set on custom FileSystem provider files should work" -tags 'Innerloop', 'DRT' {
|
||||
Describe "Breakpoints set on custom FileSystem provider files should work" -Tags "CI" {
|
||||
#
|
||||
# <Test>
|
||||
# <TestType>DRT</TestType>
|
||||
@@ -54,7 +54,7 @@ Describe "Breakpoints set on custom FileSystem provider files should work" -tags
|
||||
}
|
||||
|
||||
|
||||
Describe "Tests line breakpoints on dot-sourced files" -tags 'Innerloop', 'DRT' {
|
||||
Describe "Tests line breakpoints on dot-sourced files" -Tags "CI" {
|
||||
#
|
||||
# <Test>
|
||||
# <TestType>DRT</TestType>
|
||||
@@ -109,7 +109,7 @@ Describe "Tests line breakpoints on dot-sourced files" -tags 'Innerloop', 'DRT'
|
||||
}
|
||||
|
||||
|
||||
Describe "Function calls clear debugger cache too early" -tags 'Innerloop', 'DRT' {
|
||||
Describe "Function calls clear debugger cache too early" -Tags "CI" {
|
||||
#
|
||||
# <Test>
|
||||
# <TestType>DRT</TestType>
|
||||
@@ -164,7 +164,7 @@ Describe "Function calls clear debugger cache too early" -tags 'Innerloop', 'DRT
|
||||
}
|
||||
|
||||
|
||||
Describe "Line breakpoints on commands in multi-line pipelines" -tags 'Innerloop', 'DRT' {
|
||||
Describe "Line breakpoints on commands in multi-line pipelines" -Tags "CI" {
|
||||
#
|
||||
# <Test>
|
||||
# <TestType>DRT</TestType>
|
||||
@@ -249,7 +249,7 @@ Describe "Line breakpoints on commands in multi-line pipelines" -tags 'Innerloop
|
||||
}
|
||||
|
||||
|
||||
Describe "Unit tests for various script breakpoints" -tags 'Innerloop', 'DRT' {
|
||||
Describe "Unit tests for various script breakpoints" -Tags "CI" {
|
||||
#
|
||||
# <Test>
|
||||
# <TestType>DRT</TestType>
|
||||
@@ -416,7 +416,7 @@ Describe "Unit tests for various script breakpoints" -tags 'Innerloop', 'DRT' {
|
||||
}
|
||||
|
||||
|
||||
Describe "Unit tests for line breakpoints on dot-sourced files" -tags 'Innerloop', 'P1' {
|
||||
Describe "Unit tests for line breakpoints on dot-sourced files" -Tags "CI" {
|
||||
#
|
||||
# <Test>
|
||||
# <TestType>PriorityOne</TestType>
|
||||
@@ -504,7 +504,7 @@ Describe "Unit tests for line breakpoints on dot-sourced files" -tags 'Innerloop
|
||||
}
|
||||
|
||||
|
||||
Describe "Unit tests for line breakpoints on modules" -tags 'Innerloop', 'DRT' {
|
||||
Describe "Unit tests for line breakpoints on modules" -Tags "CI" {
|
||||
#
|
||||
# <Test>
|
||||
# <TestType>DRT</TestType>
|
||||
@@ -609,7 +609,7 @@ Describe "Unit tests for line breakpoints on modules" -tags 'Innerloop', 'DRT' {
|
||||
}
|
||||
|
||||
|
||||
Describe "Sometimes line breakpoints are ignored" -tags 'Innerloop', 'DRT' {
|
||||
Describe "Sometimes line breakpoints are ignored" -Tags "CI" {
|
||||
#####################################################################################
|
||||
#
|
||||
# <Test>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
## Debugging in Host tests
|
||||
##
|
||||
|
||||
Describe "Tests Debugger GetCallStack() on runspaces when attached to a WinRM host process" -Tags 'InnerLoop','P1' {
|
||||
Describe "Tests Debugger GetCallStack() on runspaces when attached to a WinRM host process" -Tags "CI" {
|
||||
|
||||
It -skip "Disabled test because it is fragile and does not consistently succeed on test VMs" { }
|
||||
return
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe 'Get-CimClass' {
|
||||
Describe 'Get-CimClass' -tags "CI" {
|
||||
# Get-CimClass works only on windows
|
||||
It 'can get CIM_Error CIM class' -Skip:(-not $IsWindows) {
|
||||
Get-CimClass -ClassName CIM_Error | Should Not Be $null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Import-Module" {
|
||||
Describe "Import-Module" -Tags "CI" {
|
||||
$moduleName = "Microsoft.PowerShell.Security"
|
||||
|
||||
BeforeEach {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Remove-Module" {
|
||||
Describe "Remove-Module" -Tags "CI" {
|
||||
$moduleName = "Microsoft.PowerShell.Security"
|
||||
|
||||
BeforeEach {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Set-PSDebug" {
|
||||
Describe "Set-PSDebug" -Tags "CI" {
|
||||
Context "Tracing can be used" {
|
||||
AfterEach {
|
||||
Set-PSDebug -Off
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe 'Get-WinEvent' {
|
||||
Describe 'Get-WinEvent' -Tags "CI" {
|
||||
|
||||
# Get-WinEvent works only on windows
|
||||
It 'can query a System log' -Skip:(-not $IsWindows) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Add-Content cmdlet tests" -Tags:DRT {
|
||||
Describe "Add-Content cmdlet tests" -Tags "CI" {
|
||||
$file1 = "file1.txt"
|
||||
Setup -File "$file1"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Clear-Content cmdlet tests" -Tags:DRT {
|
||||
Describe "Clear-Content cmdlet tests" -Tags "CI" {
|
||||
$file1 = "file1.txt"
|
||||
Setup -File "$file1"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ if ($IsWindows -and !$IsCoreCLR) {
|
||||
if ($windowsPrincipal.IsInRole("Administrators") -eq $true) {
|
||||
$NonWinAdmin=$false
|
||||
} else {$NonWinAdmin=$true}
|
||||
Describe "Clear-EventLog cmdlet tests" -Tags:DRT {
|
||||
Describe "Clear-EventLog cmdlet tests" -Tags "CI" {
|
||||
#DRT - CmdLet is NYI - change to -Skip:($NonWinAdmin) when implemented
|
||||
It "should be able to Clear-EventLog" -Pending:($True -Or $NonWinAdmin) {
|
||||
Remove-EventLog -LogName TestLog -ea Ignore
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-ChildItem" {
|
||||
Describe "Get-ChildItem" -Tags "CI" {
|
||||
It "Should list the contents of the current folder" {
|
||||
(Get-ChildItem .).Name.Length | Should BeGreaterThan 0
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Content" -Tags:DRT {
|
||||
Describe "Get-Content" -Tags "CI" {
|
||||
$testString = "This is a test content for a file"
|
||||
$nl = [Environment]::NewLine
|
||||
$firstline = "Here's a first line "
|
||||
@@ -131,4 +131,4 @@ Describe "Get-Content" -Tags:DRT {
|
||||
} else {$expected = "Hell","o,ll","ll","Worll","d`nHell","o2,ll","ll","Worll","d2`n"}
|
||||
for ($i = 0; $i -lt $result.Length ; $i++) { $result[$i] | Should BeExactly $expected[$i]}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
if ($windowsPrincipal.IsInRole("Administrators") -eq $true) {
|
||||
$NonWinAdmin=$false
|
||||
} else {exit}
|
||||
Describe "Get-EventLog cmdlet tests" -Tags:DRT {
|
||||
Describe "Get-EventLog cmdlet tests" -Tags "CI" {
|
||||
#CmdLets are not yet implemented, so these cases are -Pending:($True) for now...
|
||||
It "should return an array of eventlogs objects when called with -AsString parameter" -Pending:($True) {
|
||||
{$result=Get-EventLog -AsString -ea stop} | Should Not Throw
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Item" {
|
||||
Describe "Get-Item" -Tags "CI" {
|
||||
It "Should list all the items in the current working directory when asterisk is used" {
|
||||
(Get-Item (Join-Path -Path $PSScriptRoot -ChildPath "*")).GetType().BaseType | Should Be 'array'
|
||||
(Get-Item (Join-Path -Path $PSScriptRoot -ChildPath "*")).GetType().Name | Should Be 'Object[]'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-ItemProperty" {
|
||||
Describe "Get-ItemProperty" -Tags "CI" {
|
||||
$currentDirectory = Split-Path $PSScriptRoot -Leaf
|
||||
$parentDirectory = Split-Path (Join-Path -Path $PSScriptRoot -ChildPath "..") -Leaf
|
||||
$tempDirectory = $TestDrive
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Location" {
|
||||
Describe "Get-Location" -Tags "CI" {
|
||||
$currentDirectory=[System.IO.Directory]::GetCurrentDirectory()
|
||||
BeforeEach {
|
||||
pushd $currentDirectory
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-PSDrive" {
|
||||
Describe "Get-PSDrive" -Tags "CI" {
|
||||
|
||||
It "Should not throw" {
|
||||
Get-PSDrive | Should Not BeNullOrEmpty
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-PSProvider" {
|
||||
Describe "Get-PSProvider" -Tags "CI" {
|
||||
It "Should be able to call with no parameters without error" {
|
||||
{ Get-PSProvider } | Should Not Throw
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Process" {
|
||||
Describe "Get-Process" -Tags "CI" {
|
||||
It "Should support -IncludeUserName" {
|
||||
(Get-Process powershell -IncludeUserName | Select-Object -First 1).UserName | Should Match $env:USERNAME
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Hierarchical paths" {
|
||||
Describe "Hierarchical paths" -Tags "CI" {
|
||||
BeforeAll {
|
||||
$data = "Hello World"
|
||||
Setup -File testFile.txt -Content $data
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Join-Path cmdlet tests" -Tags DRT {
|
||||
Describe "Join-Path cmdlet tests" -Tags "CI" {
|
||||
$SepChar=[io.path]::DirectorySeparatorChar
|
||||
BeforeAll {
|
||||
$StartingLocation = Get-Location
|
||||
@@ -43,4 +43,4 @@ Describe "Join-Path cmdlet tests" -Tags DRT {
|
||||
$result.Count | Should be 1
|
||||
$result | Should BeExactly ("Env:"+$SepChar+"foo")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
if ($windowsPrincipal.IsInRole("Administrators") -eq $true) {
|
||||
$NonWinAdmin=$false
|
||||
} else {$NonWinAdmin=$true}
|
||||
Describe "New-EventLog cmdlet tests" -Tags DRT {
|
||||
Describe "New-EventLog cmdlet tests" -Tags "CI" {
|
||||
BeforeEach {
|
||||
Remove-EventLog -LogName TestLog -ea Ignore
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ function Clean-State
|
||||
}
|
||||
}
|
||||
|
||||
Describe "New-Item" {
|
||||
Describe "New-Item" -Tags "CI" {
|
||||
$tmpDirectory = $TestDrive
|
||||
$testfile = "testfile.txt"
|
||||
$testfolder = "newDirectory"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Pop-Location" {
|
||||
Describe "Pop-Location" -Tags "CI" {
|
||||
$startDirectory = $(Get-Location).Path
|
||||
|
||||
BeforeEach { Set-Location $startDirectory }
|
||||
@@ -25,4 +25,4 @@ Describe "Pop-Location" {
|
||||
}
|
||||
|
||||
Set-Location $startDirectory
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Test-Push-Location" {
|
||||
Describe "Test-Push-Location" -Tags "CI" {
|
||||
New-Variable -Name startDirectory -Value $(Get-Location).Path -Scope Global -Force
|
||||
|
||||
BeforeEach { cd $startDirectory }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
if ($windowsPrincipal.IsInRole("Administrators") -eq $true) {
|
||||
$NonWinAdmin=$false
|
||||
} else {$NonWinAdmin=$true}
|
||||
Describe "New-EventLog cmdlet tests" -Tags DRT {
|
||||
Describe "New-EventLog cmdlet tests" -Tags "CI" {
|
||||
BeforeEach{
|
||||
Remove-EventLog -LogName TestLog -ea Ignore
|
||||
{New-EventLog -LogName TestLog -Source TestSource -ea Stop} | Should Not Throw
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Remove-Item" {
|
||||
Describe "Remove-Item" -Tags "CI" {
|
||||
$testpath = $TestDrive
|
||||
$testfile = "testfile.txt"
|
||||
$testfilepath = Join-Path -Path $testpath -ChildPath $testfile
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Set-Content cmdlet tests" -Tags:DRT {
|
||||
Describe "Set-Content cmdlet tests" -Tags "CI" {
|
||||
$file1 = "file1.txt"
|
||||
Setup -File "$file1" -Content $file1
|
||||
Context "Set-Content should actually set content" {
|
||||
@@ -48,4 +48,4 @@ Describe "Set-Content cmdlet tests" -Tags:DRT {
|
||||
$result[1] |Should be "world"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Set-Location" {
|
||||
Describe "Set-Location" -Tags "CI" {
|
||||
$startDirectory = Get-Location
|
||||
|
||||
if ($IsWindows)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Split-Path" {
|
||||
Describe "Split-Path" -Tags "CI" {
|
||||
|
||||
It "Should return a string object when invoked" {
|
||||
( Split-Path . ).GetType().Name | Should Be "String"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Start-Process" {
|
||||
Describe "Start-Process" -Tags @("CI","SLOW") {
|
||||
$pingCommand = (Get-Command -CommandType Application ping)[0].Definition
|
||||
$pingDirectory = Split-Path $pingCommand -Parent
|
||||
$tempFile = Join-Path -Path $TestDrive -ChildPath PSTest
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Test-Path" {
|
||||
Describe "Test-Path" -Tags "CI" {
|
||||
BeforeAll {
|
||||
$testdirectory = $TestDrive
|
||||
$testfilename = New-Item -path $testdirectory -Name testfile.txt -ItemType file -Value 1 -force
|
||||
|
||||
@@ -28,7 +28,7 @@ function Assert-ListsSame
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Timezone test case no switches" -tags 'BVT' {
|
||||
Describe "Get-Timezone test case no switches" -Tags "CI" {
|
||||
It "Call without ListAvailable switch returns current TimeZoneInfo" {
|
||||
$observed = (Get-TimeZone).Id
|
||||
$expected = ([System.TimeZoneInfo]::Local).Id
|
||||
@@ -36,7 +36,7 @@ Describe "Get-Timezone test case no switches" -tags 'BVT' {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Timezone test cases" -tags 'Innerloop','RI' {
|
||||
Describe "Get-Timezone test cases" -Tags "CI" {
|
||||
|
||||
It "Call without ListAvailable switch returns an object of type TimeZoneInfo" {
|
||||
$result = (Get-TimeZone).GetType().Name
|
||||
@@ -118,7 +118,7 @@ Describe "Get-Timezone test cases" -tags 'Innerloop','RI' {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Set-Timezone test case: call by single Id" -tags 'BVT' {
|
||||
Describe "Set-Timezone test case: call by single Id" -Tags "CI" {
|
||||
$originalTimeZoneId
|
||||
BeforeAll {
|
||||
$originalTimeZoneId = (Get-TimeZone).Id
|
||||
@@ -145,7 +145,7 @@ Describe "Set-Timezone test case: call by single Id" -tags 'BVT' {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Set-Timezone test cases" -tags 'Innerloop','RI' {
|
||||
Describe "Set-Timezone test cases" -Tags "Feature" {
|
||||
$originalTimeZoneId
|
||||
BeforeAll {
|
||||
$originalTimeZoneId = (Get-TimeZone).Id
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "ExecutionPolicy" {
|
||||
Describe "ExecutionPolicy" -Tags "CI" {
|
||||
|
||||
Context "Check Get-ExecutionPolicy behavior" {
|
||||
It "Should unrestricted when not on Windows" -Skip:$IsWindows {
|
||||
|
||||
@@ -7,7 +7,7 @@ if ($IsWindows) {
|
||||
|
||||
$script:catalogPath = ""
|
||||
|
||||
Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "Innerloop","BVT" {
|
||||
Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "CI" {
|
||||
|
||||
#compare two hashtables
|
||||
function CompareHashTables
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Add-Member DRT Unit Tests" -Tags DRT{
|
||||
Describe "Add-Member DRT Unit Tests" -Tags "CI" {
|
||||
|
||||
It "Mandatory parameters should not be null nor empty" {
|
||||
# when Name is null
|
||||
@@ -278,7 +278,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Add-Member" {
|
||||
Describe "Add-Member" -Tags "CI" {
|
||||
|
||||
It "should be able to see a newly added member of an object" {
|
||||
$o = New-Object psobject
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
$guid = [Guid]::NewGuid().ToString().Replace("-","")
|
||||
|
||||
Describe "Add-Type" {
|
||||
It "Should not throw given a simple class definition" {
|
||||
Describe "Add-Type" -Tags "CI" {
|
||||
It "Should not throw given a simple class definition" -pending:($IsCoreCLR) {
|
||||
{ Add-Type -TypeDefinition "public static class foo { }" } | Should Not Throw
|
||||
}
|
||||
|
||||
It "Can use System.Management.Automation.CmdletAttribute" {
|
||||
It "Can use System.Management.Automation.CmdletAttribute" -pending:($IsCoreCLR) {
|
||||
$code = @"
|
||||
[System.Management.Automation.Cmdlet("Get", "Thing", ConfirmImpact = System.Management.Automation.ConfirmImpact.High, SupportsPaging = true)]
|
||||
public class AttributeTest$guid {}
|
||||
@@ -13,7 +13,7 @@ public class AttributeTest$guid {}
|
||||
Add-Type -TypeDefinition $code -PassThru | Should Not Be $null
|
||||
}
|
||||
|
||||
It "Can load TPA assembly System.Runtime.Serialization.Primitives.dll" {
|
||||
It "Can load TPA assembly System.Runtime.Serialization.Primitives.dll" -pending:($IsCoreCLR) {
|
||||
Add-Type -AssemblyName 'System.Runtime.Serialization.Primitives' -PassThru | Should Not Be $null
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Clear-Variable DRT Unit Tests" -Tags DRT{
|
||||
Describe "Clear-Variable DRT Unit Tests" -Tags "CI" {
|
||||
It "Clear-Variable normal variable Name should works"{
|
||||
Set-Variable foo bar
|
||||
Clear-Variable -Name foo
|
||||
@@ -97,7 +97,7 @@ Describe "Clear-Variable DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Clear-Variable" {
|
||||
Describe "Clear-Variable" -Tags "CI" {
|
||||
BeforeEach {
|
||||
$var1 = 3
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Compare-Object" {
|
||||
Describe "Compare-Object" -Tags "CI" {
|
||||
BeforeAll {
|
||||
$nl = [Environment]::NewLine
|
||||
|
||||
@@ -120,7 +120,7 @@ Describe "Compare-Object" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Compare-Object DRT basic functionality" -Tags DRT{
|
||||
Describe "Compare-Object DRT basic functionality" -Tags "CI" {
|
||||
if(-not ([System.Management.Automation.PSTypeName]'Employee').Type)
|
||||
{
|
||||
Add-Type -TypeDefinition @"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
|
||||
Describe "ConvertFrom-Csv" {
|
||||
Describe "ConvertFrom-Csv" -Tags "CI" {
|
||||
$testObject = "a", "1"
|
||||
$testcsv = Join-Path -Path (Join-Path -Path $here -ChildPath assets) -ChildPath TestCsv2.csv
|
||||
$testName = "Zaphod BeebleBrox"
|
||||
@@ -51,7 +51,7 @@ a,b,c
|
||||
}
|
||||
}
|
||||
|
||||
Describe "ConvertFrom-Csv DRT Unit Tests" -Tags DRT{
|
||||
Describe "ConvertFrom-Csv DRT Unit Tests" -Tags "CI" {
|
||||
It "Test ConvertFrom-Csv with pipelined InputObject and Header" {
|
||||
$inputObject = [pscustomobject]@{ First = 1; Second = 2 }
|
||||
$res = $inputObject | ConvertTo-Csv
|
||||
@@ -62,4 +62,4 @@ Describe "ConvertFrom-Csv DRT Unit Tests" -Tags DRT{
|
||||
$result[1].Header1 | Should Be "1"
|
||||
$result[1].Header2 | Should Be "2"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe 'ConvertFrom-Json' {
|
||||
Describe 'ConvertFrom-Json' -tags "CI" {
|
||||
It 'can convert a single-line object' {
|
||||
('{"a" : "1"}' | ConvertFrom-Json).a | Should Be 1
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
Describe "ConvertFrom-StringData DRT Unit Tests" -Tags DRT {
|
||||
Describe "ConvertFrom-StringData DRT Unit Tests" -Tags "CI" {
|
||||
It "Should able to throw error when convert invalid line" {
|
||||
$str =@"
|
||||
#comments here
|
||||
@@ -18,7 +18,7 @@ def=content of def
|
||||
}
|
||||
}
|
||||
|
||||
Describe "ConvertFrom-StringData" {
|
||||
Describe "ConvertFrom-StringData" -Tags "CI" {
|
||||
$sampleData = @'
|
||||
foo = 0
|
||||
bar = 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "ConvertTo-Csv DRT Unit Tests" -Tags DRT{
|
||||
Describe "ConvertTo-Csv DRT Unit Tests" -Tags "CI" {
|
||||
$inputObject = [pscustomobject]@{ First = 1; Second = 2 }
|
||||
|
||||
It "Test convertto-csv with psobject pipelined" {
|
||||
@@ -35,7 +35,7 @@ Describe "ConvertTo-Csv DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "ConvertTo-Csv" {
|
||||
Describe "ConvertTo-Csv" -Tags "CI" {
|
||||
$Name = "Hello"; $Data = "World";
|
||||
$testObject = New-Object psobject -Property @{ FirstColumn = $Name; SecondColumn = $Data }
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Describe "ConvertTo-SecureString" {
|
||||
Describe "ConvertTo-SecureString" -Tags "CI" {
|
||||
|
||||
Context "Checking return types of ConvertTo-SecureString" {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "ConvertTo-Xml DRT Unit Tests" -Tags DRT{
|
||||
Describe "ConvertTo-Xml DRT Unit Tests" -Tags "CI" {
|
||||
$customPSObject = [pscustomobject]@{ "prop1" = "val1"; "prop2" = "val2" }
|
||||
$newLine = [System.Environment]::NewLine
|
||||
It "Test convertto-xml with a depth parameter" {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
$removeAliasList = @("ac","compare","cpp","diff","sleep","sort","start","cat","cp","ls","man","mount","mv","ps","rm","rmdir")
|
||||
$keepAliasList = @{cd="Set-Location"},@{dir="Get-ChildItem"},@{echo="Write-output"},@{fc="format-custom"},@{kill="stop-process"},@{clear="clear-host"}
|
||||
Describe "Windows aliases do not conflict with Linux commands" {
|
||||
Describe "Windows aliases do not conflict with Linux commands" -Tags "CI" {
|
||||
foreach ($alias in $removeAliasList) {
|
||||
It "Should not have certain aliases on Linux" -Skip:$IsWindows {
|
||||
Test-Path Alias:$alias | Should Be $false
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Describe "Environment-Variables" {
|
||||
Describe "Environment-Variables" -Tags "CI" {
|
||||
|
||||
It "Should have environment variables" {
|
||||
Get-Item ENV: | Should Not BeNullOrEmpty
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Export-Alias DRT Unit Tests" -Tags DRT{
|
||||
Describe "Export-Alias DRT Unit Tests" -Tags "CI" {
|
||||
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory
|
||||
$testAliases = "TestAliases"
|
||||
$fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases
|
||||
@@ -124,7 +124,7 @@ Describe "Export-Alias DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Export-Alias" {
|
||||
Describe "Export-Alias" -Tags "CI" {
|
||||
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory
|
||||
$testAliases = "TestAliases"
|
||||
$fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Export-Csv" {
|
||||
Describe "Export-Csv" -Tags "CI" {
|
||||
$testObject = @("test","object","array")
|
||||
$testCsv = "output.csv"
|
||||
|
||||
@@ -65,7 +65,7 @@ Describe "Export-Csv" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Export-Csv DRT Unit Tests" -Tags DRT{
|
||||
Describe "Export-Csv DRT Unit Tests" -Tags "CI" {
|
||||
$filePath = Join-Path $TestDrive -ChildPath "test.csv"
|
||||
$newLine = [environment]::NewLine
|
||||
It "Test basic function works well" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Export-FormatData DRT Unit Tests" -Tags DRT{
|
||||
Describe "Export-FormatData DRT Unit Tests" -Tags "CI" {
|
||||
It "Test basic functionality" {
|
||||
$fd = Get-FormatData
|
||||
$tempFile = Join-Path $TestDrive -ChildPath "exportFormatTest.txt"
|
||||
@@ -14,7 +14,7 @@ Describe "Export-FormatData DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Export-FormatData" {
|
||||
Describe "Export-FormatData" -Tags "CI" {
|
||||
|
||||
Context "Check Export-FormatData can be called validly." {
|
||||
It "Should be able to be called without error" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Format-Custom" {
|
||||
Describe "Format-Custom" -Tags "CI" {
|
||||
|
||||
Context "Check Format-Custom aliases" {
|
||||
|
||||
@@ -25,7 +25,7 @@ Describe "Format-Custom" {
|
||||
}
|
||||
|
||||
|
||||
Describe "Format-Custom DRT basic functionality" -Tags DRT{
|
||||
Describe "Format-Custom DRT basic functionality" -Tags "CI" {
|
||||
Add-Type -TypeDefinition @"
|
||||
public abstract class NamedItem
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Format-List" {
|
||||
Describe "Format-List" -Tags "CI" {
|
||||
$nl = [Environment]::NewLine
|
||||
BeforeEach {
|
||||
$in = New-Object PSObject
|
||||
@@ -67,7 +67,7 @@ Describe "Format-List" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Format-List DRT basic functionality" -Tags DRT{
|
||||
Describe "Format-List DRT basic functionality" -Tags "CI" {
|
||||
It "Format-List with array should work" {
|
||||
$al = (0..255)
|
||||
$info = @{}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Format-Table" {
|
||||
Describe "Format-Table" -Tags "CI" {
|
||||
It "Should call format table on piped input without error" {
|
||||
{ Get-Date | Format-Table } | Should Not Throw
|
||||
|
||||
@@ -28,7 +28,7 @@ Describe "Format-Table" {
|
||||
}
|
||||
|
||||
|
||||
Describe "Format-Table DRT Unit Tests" -Tags DRT{
|
||||
Describe "Format-Table DRT Unit Tests" -Tags "CI" {
|
||||
It "Format-Table with not existing table with force should throw PipelineStoppedException"{
|
||||
$obj = New-Object -typename PSObject
|
||||
try
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Format-Wide" {
|
||||
Describe "Format-Wide" -Tags "CI" {
|
||||
|
||||
It "Should have the same output between the alias and the unaliased function" {
|
||||
$nonaliased = Get-ChildItem | Format-Wide
|
||||
@@ -39,7 +39,7 @@ Describe "Format-Wide" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Format-Wide DRT basic functionality" -Tags DRT{
|
||||
Describe "Format-Wide DRT basic functionality" -Tags "CI" {
|
||||
It "Format-Wide with array should work" {
|
||||
$al = (0..255)
|
||||
$info = @{}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
Describe "Get-Alias DRT Unit Tests" -Tags DRT{
|
||||
Describe "Get-Alias DRT Unit Tests" -Tags "CI" {
|
||||
It "Get-Alias Bogus Scope Name should throw PSArgumentException"{
|
||||
try {
|
||||
Get-Alias -Name "ABCD" -Scope "bogus"
|
||||
@@ -173,7 +173,7 @@ Describe "Get-Alias DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Alias" {
|
||||
Describe "Get-Alias" -Tags "CI" {
|
||||
It "Should have a return type of System.Array when gal returns more than one object" {
|
||||
$val1=(Get-Alias a*)
|
||||
$val2=(Get-Alias c*)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Culture DRT Unit Tests" -Tags DRT{
|
||||
Describe "Get-Culture DRT Unit Tests" -Tags "CI" {
|
||||
It "Should works proper with get-culture" {
|
||||
$results = get-Culture
|
||||
$results -is "System.Globalization.CultureInfo" | Should be $true
|
||||
@@ -6,7 +6,7 @@ Describe "Get-Culture DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Culture" {
|
||||
Describe "Get-Culture" -Tags "CI" {
|
||||
|
||||
It "Should return a type of CultureInfo for Get-Culture cmdlet" {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Date DRT Unit Tests" -Tags DRT {
|
||||
Describe "Get-Date DRT Unit Tests" -Tags "CI" {
|
||||
It "Get-Date with all parameters returns proper results" {
|
||||
$date = [datetime]::Now + ([timespan]::new(0,0,30))
|
||||
$result = Get-Date -Date $date -Year 1973 -Month 2 -Day 22 -Hour 15 -Minute 40 -Second 10 -Millisecond 200
|
||||
@@ -80,7 +80,7 @@ Describe "Get-Date DRT Unit Tests" -Tags DRT {
|
||||
}
|
||||
|
||||
|
||||
Describe "Get-Date" {
|
||||
Describe "Get-Date" -Tags "CI" {
|
||||
It "Should return a DateTime object upon being called" {
|
||||
(Get-Date).GetType().Name.Equals('DateTime') | Should Be $true
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Event" {
|
||||
Describe "Get-Event" -Tags "CI" {
|
||||
|
||||
BeforeEach {
|
||||
( New-Event -SourceIdentifier PesterTestEvent -sender Windows.timer -messagedata "PesterTestMessage" )
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-EventSubscriber" {
|
||||
Describe "Get-EventSubscriber" -Tags "CI" {
|
||||
|
||||
AfterEach {
|
||||
Unregister-Event -SourceIdentifier PesterTestRegister -ErrorAction SilentlyContinue
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-FileHash" {
|
||||
Describe "Get-FileHash" -Tags "CI" {
|
||||
New-Variable testDocument -Value (Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath testablescript.ps1) -Scope Global -Force
|
||||
# The MACTripleDES and RIPEMD160 algorithms are unsupported on Linux
|
||||
$algorithms = @{"SHA1" ="01B865D143E07ECC875AB0EFC0A4429387FD0CF7";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-FormatData" {
|
||||
Describe "Get-FormatData" -Tags "CI" {
|
||||
|
||||
Context "Check return type of Get-FormatData" {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Host DRT Unit Tests" -Tags DRT{
|
||||
Describe "Get-Host DRT Unit Tests" -Tags "CI" {
|
||||
It "Should works proper with get-host" {
|
||||
$results = Get-Host
|
||||
$results | Should Be $Host
|
||||
@@ -6,7 +6,7 @@ Describe "Get-Host DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Host" {
|
||||
Describe "Get-Host" -Tags "CI" {
|
||||
It "Should return a type of InternalHost for Get-Host cmdlet" {
|
||||
|
||||
(Get-Host).GetType().Name | Should Be InternalHost
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Member" {
|
||||
Describe "Get-Member" -Tags "CI" {
|
||||
It "Should be able to be called on string objects, ints, arrays, etc" {
|
||||
$a = 1 #test numbers
|
||||
$b = 1.3
|
||||
@@ -40,7 +40,7 @@ Describe "Get-Member" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Member DRT Unit Tests" -Tags DRT {
|
||||
Describe "Get-Member DRT Unit Tests" -Tags "CI" {
|
||||
Context "Verify Get-Member with Class" {
|
||||
if(-not ([System.Management.Automation.PSTypeName]'Employee').Type)
|
||||
{
|
||||
@@ -291,4 +291,4 @@ Describe "Get-Member DRT Unit Tests" -Tags DRT {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-PSBreakpoint" {
|
||||
Describe "Get-PSBreakpoint" -Tags "CI" {
|
||||
|
||||
$scriptName = "Get-PSBreakpoint.Tests.ps1"
|
||||
$fullScriptPath = Join-Path -Path $PSScriptRoot -ChildPath $scriptName
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-PSCallStack DRT Unit Tests" -Tags DRT {
|
||||
Describe "Get-PSCallStack DRT Unit Tests" -Tags "CI" {
|
||||
BeforeAll {
|
||||
$scriptFileName = "GetTryCatchCallStack.ps1"
|
||||
$scriptFilePath = Join-Path $TestDrive -ChildPath $scriptFileName
|
||||
@@ -84,4 +84,4 @@
|
||||
$results[1].ScriptLineNumber | Should be 7
|
||||
$results[1].InvocationInfo.ScriptLineNumber | Should be 75
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Random DRT Unit Tests" -Tags DRT{
|
||||
Describe "Get-Random DRT Unit Tests" -Tags "CI" {
|
||||
$testData = @(
|
||||
@{ Name = 'no params'; Maximum = $null; Minimum = $null; GreaterThan = -1; LessThan = ([int32]::MaxValue); Type = 'System.Int32' }
|
||||
@{ Name = 'only positive maximum number'; Maximum = 100; Minimum = $null; GreaterThan = -1; LessThan = 100; Type = 'System.Int32' }
|
||||
@@ -89,7 +89,7 @@ Describe "Get-Random DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Random" {
|
||||
Describe "Get-Random" -Tags "CI" {
|
||||
It "Should return a random number greater than -1 " {
|
||||
Get-Random | Should BeGreaterThan -1
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-RunspaceDebug" {
|
||||
Describe "Get-RunspaceDebug" -Tags "CI" {
|
||||
|
||||
Context "Check return types of RunspaceDebug" {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-TraceSource" -tags "P1" {
|
||||
Describe "Get-TraceSource" -Tags "Feature" {
|
||||
It "Should output data sorted by name" {
|
||||
$expected = (Get-TraceSource | Sort-Object Name)
|
||||
Get-TraceSource | Should be $expected
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-UICulture" {
|
||||
Describe "Get-UICulture" -Tags "CI" {
|
||||
It "Should return a type of CultureInfo as the name of the type" {
|
||||
(Get-UICulture).GetType().Name | Should Match CultureInfo
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-Unique DRT Unit Tests" -Tags DRT{
|
||||
Describe "Get-Unique DRT Unit Tests" -Tags "CI" {
|
||||
It "Command get-unique works with AsString switch" {
|
||||
$inputArray = "aa","aa","Aa","ba","BA","BA"
|
||||
$results = $inputArray | Get-Unique -AsString
|
||||
@@ -17,7 +17,7 @@ Describe "Get-Unique DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Unique" {
|
||||
Describe "Get-Unique" -Tags "CI" {
|
||||
$sortedList1 = 1,2,2,3,3,4,5
|
||||
It "Should be able to use the Get-Unique cmdlet without error with inputObject switch" {
|
||||
{ Get-Unique -InputObject $sortedList1 } | Should Not Throw
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
Describe "Get-Variable DRT Unit Tests" -Tags DRT{
|
||||
Describe "Get-Variable DRT Unit Tests" -Tags "CI" {
|
||||
It "Get-Variable of not existing variable Name should throw ItemNotFoundException"{
|
||||
try {
|
||||
Get-Variable -EA Stop -Name nonexistingVariableName
|
||||
@@ -52,7 +52,7 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-Variable" {
|
||||
Describe "Get-Variable" -Tags "CI" {
|
||||
It "Should be able to call with no parameters without error" {
|
||||
{ Get-Variable } | Should Not Throw
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Group-Object DRT Unit Tests" -Tags DRT{
|
||||
Describe "Group-Object DRT Unit Tests" -Tags "CI" {
|
||||
It "Test for CaseSensitive switch" {
|
||||
$testObject = 'aA', 'aA', 'AA', 'AA'
|
||||
$results = $testObject | Group-Object -CaseSensitive
|
||||
@@ -11,7 +11,7 @@ Describe "Group-Object DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Group-Object" {
|
||||
Describe "Group-Object" -Tags "CI" {
|
||||
$testObject = Get-ChildItem
|
||||
|
||||
It "Should be called using an object as piped without error with no switches" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Import-Alias DRT Unit Tests" -Tags DRT{
|
||||
Describe "Import-Alias DRT Unit Tests" -Tags "CI" {
|
||||
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ImportAliasTestDirectory
|
||||
$testAliases = "TestAliases"
|
||||
$fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases
|
||||
@@ -61,7 +61,7 @@ Describe "Import-Alias DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Import-Alias" {
|
||||
Describe "Import-Alias" -Tags "CI" {
|
||||
$newLine=[Environment]::NewLine
|
||||
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ImportAliasTestDirectory
|
||||
$testAliases = "pesteralias.txt"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Import-Csv" {
|
||||
Describe "Import-Csv" -Tags "CI" {
|
||||
$testCsv = Join-Path -Path (Join-Path $PSScriptRoot -ChildPath assets) -ChildPath TestCsv.csv
|
||||
|
||||
It "Should be able to call without error" {
|
||||
@@ -50,7 +50,7 @@ Describe "Import-Csv" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Import-Csv DRT Unit Tests" -Tags DRT {
|
||||
Describe "Import-Csv DRT Unit Tests" -Tags "CI" {
|
||||
BeforeAll {
|
||||
$fileToGenerate = Join-Path $TestDrive -ChildPath "importCSVTest.csv"
|
||||
$psObject = [pscustomobject]@{ "First" = "1"; "Second" = "2" }
|
||||
|
||||
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user