mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-14 07:13:15 +00:00
Fix test not working with single digit dates.
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Default')]
|
[CmdletBinding(DefaultParameterSetName = 'Default')]
|
||||||
param(
|
param(
|
||||||
[Parameter(Position=0)]
|
[Parameter(Position=0)]
|
||||||
@@ -30,10 +29,10 @@ param(
|
|||||||
[string[]]$ExcludeTag,
|
[string[]]$ExcludeTag,
|
||||||
|
|
||||||
[Parameter(ParameterSetName='Default')]
|
[Parameter(ParameterSetName='Default')]
|
||||||
[Switch]$Strict,
|
[switch]$Strict,
|
||||||
|
|
||||||
[String]$WorkSheetName = 'PesterResults',
|
|
||||||
|
|
||||||
|
[string]$WorkSheetName = 'PesterResults',
|
||||||
|
[switch]$append,
|
||||||
[switch]$Show
|
[switch]$Show
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -45,6 +44,7 @@ if ($InvokePesterParams['Show'] ) {}
|
|||||||
if ($InvokePesterParams['XLFile']) {$InvokePesterParams.Remove('XLFile')}
|
if ($InvokePesterParams['XLFile']) {$InvokePesterParams.Remove('XLFile')}
|
||||||
else {$XLFile = $InvokePesterParams['OutputFile'] -replace '.xml$','.xlsx'}
|
else {$XLFile = $InvokePesterParams['OutputFile'] -replace '.xml$','.xlsx'}
|
||||||
if (-not $UseExisting) {
|
if (-not $UseExisting) {
|
||||||
|
$InvokePesterParams.Remove('Append')
|
||||||
$InvokePesterParams.Remove('UseExisting')
|
$InvokePesterParams.Remove('UseExisting')
|
||||||
$InvokePesterParams.Remove('Show')
|
$InvokePesterParams.Remove('Show')
|
||||||
$InvokePesterParams.Remove('WorkSheetName')
|
$InvokePesterParams.Remove('WorkSheetName')
|
||||||
@@ -73,7 +73,10 @@ $os = $resultXML.environment.platform -replace '\|.*$'," $($resultXML.e
|
|||||||
Test-Suite [Name] = Context block name [result], [Time] to execute etc.
|
Test-Suite [Name] = Context block name [result], [Time] to execute etc.
|
||||||
Results
|
Results
|
||||||
Test-Case [name] = Describe.Context.It block names [description]= it block name, result], [Time] to execute etc
|
Test-Case [name] = Describe.Context.It block names [description]= it block name, result], [Time] to execute etc
|
||||||
|
or if the tests are parameterized
|
||||||
|
Test suite [description] - name in the the it block with <vars> not filled in
|
||||||
|
Results
|
||||||
|
Test-case [description] - name as rendered for display with <vars> filled in
|
||||||
#>
|
#>
|
||||||
$testResults = foreach ($test in $resultXML.'test-suite'.results.'test-suite') {
|
$testResults = foreach ($test in $resultXML.'test-suite'.results.'test-suite') {
|
||||||
$testPs1File = $test.name
|
$testPs1File = $test.name
|
||||||
@@ -83,7 +86,11 @@ $testResults = foreach ($test in $resultXML.'test-suite'.results.'test-suite') {
|
|||||||
$Describe = $suite.description
|
$Describe = $suite.description
|
||||||
foreach ($subsuite in $suite.results.'test-suite') {
|
foreach ($subsuite in $suite.results.'test-suite') {
|
||||||
$Context = $subsuite.description
|
$Context = $subsuite.description
|
||||||
$subsuite.results.'test-case'| ForEach-Object {
|
if ($subsuite.results.'test-suite'.results.'test-case') {
|
||||||
|
$testCases = $subsuite.results.'test-suite'.results.'test-case'
|
||||||
|
}
|
||||||
|
else {$testCases = $subsuite.results.'test-case'}
|
||||||
|
$testCases | ForEach-Object {
|
||||||
New-Object -TypeName psobject -Property ([ordered]@{
|
New-Object -TypeName psobject -Property ([ordered]@{
|
||||||
Machine = $machine ; OS = $os
|
Machine = $machine ; OS = $os
|
||||||
Date = $startDate ; Time = $startTime
|
Date = $startDate ; Time = $startTime
|
||||||
@@ -110,9 +117,10 @@ $testResults = foreach ($test in $resultXML.'test-suite'.results.'test-suite') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (-not $testResults) {Write-Warning 'No Results found' ; return}
|
||||||
$excel = $testResults | Export-Excel -Path $xlFile -WorkSheetname $WorkSheetName -ClearSheet -PassThru -BoldTopRow -FreezeTopRow -AutoSize -AutoFilter -AutoNameRange
|
$clearSheet = -not $Append
|
||||||
$ws = $excel.Workbook.Worksheets["PesterResults"]
|
$excel = $testResults | Export-Excel -Path $xlFile -WorkSheetname $WorkSheetName -ClearSheet:$clearSheet -Append:$append -PassThru -BoldTopRow -FreezeTopRow -AutoSize -AutoFilter -AutoNameRange
|
||||||
|
$ws = $excel.Workbook.Worksheets[$WorkSheetName]
|
||||||
|
|
||||||
<# Worksheet should look like ...
|
<# Worksheet should look like ...
|
||||||
|A |B |C D |E |F |G |H |I |J |K |L
|
|A |B |C D |E |F |G |H |I |J |K |L
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Describe 'ConvertFrom-ExcelSheet / Export-ExcelSheet' {
|
|||||||
$secondText[1] | Should -Belike "*$date*"
|
$secondText[1] | Should -Belike "*$date*"
|
||||||
$secondText[1] | Should -Match '"0\d","\w+","\d{1,2}"$'
|
$secondText[1] | Should -Match '"0\d","\w+","\d{1,2}"$'
|
||||||
$ThirdText[1] | Should -Match '^"\w+ \w+","#\d\d/\d\d/\d{4}#","\d","0\d"$'
|
$ThirdText[1] | Should -Match '^"\w+ \w+","#\d\d/\d\d/\d{4}#","\d","0\d"$'
|
||||||
$FourthText[1] | Should -Match '^"\w+","[012]\d'
|
$FourthText[1] | Should -Match '^"\w+","([012]\d/|[1-9]/)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Context "Export aliased to ConvertFrom" {
|
Context "Export aliased to ConvertFrom" {
|
||||||
|
|||||||
Reference in New Issue
Block a user