Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit ff35738

Browse files
authored
Merge branch 'master' into master
2 parents 51a49a2 + 3fde749 commit ff35738

File tree

6 files changed

+33
-17
lines changed

6 files changed

+33
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1818

1919
- PR25 - Discover Pester 'Describe' block names when the -Name parameter is used (via @GitAMBS)
2020
- PR29 - Remove Pester 4.0+ warning by using -Show parameter instead of -Quiet. Add -UseBasicParsing parameter to Invoke-WebRequest in tests (via @larssb)
21+
- Fixed #3 where an error would be generated when using Invoke-OperationValidation with the -TestFilePath parameter
22+
against a Pester test file with a short path.
2123

2224
## [1.0.1] - 2015-12-05
2325

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11

2-
# emit an object which can be used in reporting
3-
Function Convert-TestResult
4-
{
5-
param ( $result )
6-
foreach ( $testResult in $result.TestResult )
7-
{
2+
# Emit an object which can be used in reporting
3+
Function Convert-TestResult {
4+
param (
5+
[Parameter(Mandatory = $true)]
6+
$result,
7+
8+
[string]$ModuleName
9+
)
10+
11+
foreach ( $testResult in $result.TestResult ) {
812
$testError = $null
9-
if ( $testResult.Result -eq "Failed" )
10-
{
11-
Write-Verbose -message "Creating error object"
12-
$testError = new-OperationValidationFailure -Stacktrace $testResult.StackTrace -FailureMessage $testResult.FailureMessage
13+
if ( $testResult.Result -eq 'Failed' ) {
14+
Write-Verbose -message 'Creating error object'
15+
$testError = New-OperationValidationFailure -Stacktrace $testResult.StackTrace -FailureMessage $testResult.FailureMessage
16+
}
17+
18+
$TestName = '{0}:{1}:{2}' -f $testResult.Describe, $testResult.Context, $testResult.Name
19+
20+
$newOVResultParams = @{
21+
Name = $TestName
22+
FileName = $result.path
23+
Result = $testresult.result
24+
RawResult = $testResult
25+
Error = $TestError
26+
}
27+
if (-not [string]::IsNullOrEmpty($ModuleName)) {
28+
$newOVResultParams['Module'] = $ModuleName
1329
}
14-
$Module = $result.Path.split([io.path]::DirectorySeparatorChar)[-4]
15-
$TestName = "{0}:{1}:{2}" -f $testResult.Describe,$testResult.Context,$testResult.Name
16-
New-OperationValidationResult -Module $Module -Name $TestName -FileName $result.path -Result $testresult.result -RawResult $testResult -Error $TestError
30+
New-OperationValidationResult @newOVResultParams
1731
}
1832
}

OperationValidation/Private/New-OperationValidationResult.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ function New-OperationValidationResult
33
{
44
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Scope='Function', Target='*')]
55
param (
6-
[Parameter(Mandatory=$true)][string]$Module,
76
[Parameter(Mandatory=$true)][string]$FileName,
87
[Parameter(Mandatory=$true)][string]$Name,
98
[Parameter(Mandatory=$true)][string]$Result,
9+
[Parameter()][string]$Module,
1010
[Parameter()][object]$RawResult,
1111
[Parameter()][object]$Error
1212
)

OperationValidation/Public/Invoke-OperationValidation.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ function Invoke-OperationValidation
314314
if ($testResult)
315315
{
316316
Add-member -InputObject $testResult -MemberType NoteProperty -Name Path -Value $ti.FilePath
317-
Convert-TestResult -Result $testResult -ModuleName $ModuleName
317+
Convert-TestResult -Result $testResult -ModuleName $ti.ModuleName
318318
}
319319
}
320320
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Operation-Validation-Framework
33

4-
[![Build status](https://ci.appveyor.com/api/projects/status/rili6ki88ioyq23t?svg=true)](https://ci.appveyor.com/project/devblackops/operation-validation-framework)
4+
[![Build status](https://ci.appveyor.com/api/projects/status/rvbve3ajjtn4m0n2?svg=true)](https://ci.appveyor.com/project/devblackops/operation-validation-framework-a635v)
55

66
A set of tools for executing validation of the operation of a system.
77
It provides a way to organize and execute Pester tests which are written

Tests/OperationValidation.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Describe "OperationValidation Module Tests" {
2323

2424
Context "Get-OperationValidation parameters" {
2525
It "ModuleName parameter is proper type" {
26-
$commands[0].Parameters['ModuleName'].ParameterType | Should be ([System.String[]])
26+
$commands[0].Parameters['Name'].ParameterType | Should be ([System.String[]])
2727
}
2828
It "Version parameter is proper type" {
2929
$commands[0].Parameters['Version'].ParameterType | Should be ([System.Version])

0 commit comments

Comments
 (0)