mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
updated
This commit is contained in:
36
Examples/TestRestAPI/RunAndShowUnitTests.ps1
Normal file
36
Examples/TestRestAPI/RunAndShowUnitTests.ps1
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
$xlfilename=".\test.xlsx"
|
||||||
|
rm $xlfilename -ErrorAction Ignore
|
||||||
|
|
||||||
|
$ConditionalText = @()
|
||||||
|
$ConditionalText += New-ConditionalText -Range "C:C" -Text failed -BackgroundColor red -ConditionalTextColor black
|
||||||
|
$ConditionalText += New-ConditionalText -Range "C:C" -Text passed -BackgroundColor green -ConditionalTextColor black
|
||||||
|
|
||||||
|
$r = .\TryIt.ps1
|
||||||
|
|
||||||
|
$xlPkg = $(foreach($result in $r.TestResult) {
|
||||||
|
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Name = $result.Name
|
||||||
|
#Time = $result.Time
|
||||||
|
Result = $result.Result
|
||||||
|
Messge = $result.FailureMessage
|
||||||
|
StackTrace = $result.StackTrace
|
||||||
|
}
|
||||||
|
|
||||||
|
}) | Export-Excel -Path $xlfilename -AutoSize -ConditionalText $ConditionalText -PassThru
|
||||||
|
|
||||||
|
$sheet1 = $xlPkg.Workbook.Worksheets["sheet1"]
|
||||||
|
|
||||||
|
$sheet1.View.ShowGridLines = $false
|
||||||
|
$sheet1.View.ShowHeaders = $false
|
||||||
|
|
||||||
|
Set-Format -Address $sheet1.Cells["A:A"] -AutoSize
|
||||||
|
Set-Format -Address $sheet1.Cells["B:D"] -WrapText
|
||||||
|
|
||||||
|
$sheet1.InsertColumn(1, 1)
|
||||||
|
Set-Format -Address $sheet1.Cells["A:A"] -Width 5
|
||||||
|
|
||||||
|
Set-Format -Address $sheet1.Cells["B1:E1"] -HorizontalAlignment Center -BorderBottom Thick -BorderColor Cyan
|
||||||
|
|
||||||
|
Close-ExcelPackage $xlPkg -Show
|
||||||
@@ -41,5 +41,7 @@ $($blocks)
|
|||||||
}
|
}
|
||||||
"@ | Set-Content -Encoding Ascii $testFileName
|
"@ | Set-Content -Encoding Ascii $testFileName
|
||||||
|
|
||||||
Invoke-Pester -Script (dir $testFileName)
|
#Invoke-Pester -Script (Get-ChildItem $testFileName)
|
||||||
|
Get-ChildItem $testFileName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
Test-APIReadXls $PSScriptRoot\testlist.xlsx
|
. $PSScriptRoot\TestAPIReadXls.ps1
|
||||||
|
|
||||||
|
Test-APIReadXls $PSScriptRoot\testlist.xlsx | % {
|
||||||
|
Invoke-Pester -Script $_.fullname -PassThru -Show None
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user