ScriptCop.Format.ps1xml
<?xml version="1.0" encoding="utf-16"?>
<Configuration> <ViewDefinitions> <View> <Name>ScriptCopError</Name> <ViewSelectedBy> <TypeName>ScriptCopError</TypeName> </ViewSelectedBy> <GroupBy> <PropertyName>Rule</PropertyName> </GroupBy> <TableControl> <TableHeaders> <TableColumnHeader> </TableColumnHeader> <TableColumnHeader> </TableColumnHeader> </TableHeaders> <TableRowEntries> <TableRowEntry> <Wrap /> <TableColumnItems> <TableColumnItem> <PropertyName>Problem</PropertyName> </TableColumnItem> <TableColumnItem> <PropertyName>ItemWithProblem</PropertyName> </TableColumnItem> </TableColumnItems> </TableRowEntry> </TableRowEntries> </TableControl> </View> <View> <Name>ScriptCop.Test.Pass.Output</Name> <ViewSelectedBy> <TypeName>ScriptCop.Test.Pass.Output</TypeName> </ViewSelectedBy> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <Frame> <CustomItem> <ExpressionBinding> <ScriptBlock> $writeColor = if ($_.Passed) { "DarkGreen" } else { "Red" } $testStatus = if ($_.Passed) { "--- Passed --- " } else { "*** Failed *** " } if (-not ($request -and $response)) { $msg = " $($_.TestPass)" $testStatus = $testStatus.PadLeft($host.ui.RawUI.BufferSize.Width - $msg.Length) Write-Host " " Write-Host "${Msg}$testStatus" -ForegroundColor $writeColor -NoNewline Write-Host " " $null= ($_.Results | Out-String) '' } else { "<div style='background-color:$writeColor;color:#ffffff'> <div style='float:left;width:20%;font-size:1.22em'> <h3> $($_.TestPass) </h3> </div> <div style='float:right;width:20%;text-align:right;'> <span style='color:#ffffff;font-size:1.22em'>$testStatus</span> </div> <br style='clear:both'/> <div style='width:80%;margin-left:20%'> $($_.Results | Out-html) </div> </div> " } </ScriptBlock> </ExpressionBinding> </CustomItem> </Frame> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </View> <View> <Name>ScriptCop.Test.Output</Name> <ViewSelectedBy> <TypeName>ScriptCop.Test.Output</TypeName> </ViewSelectedBy> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <Frame> <CustomItem> <ExpressionBinding> <ScriptBlock> $writeColor = if ($_.Passed) { "DarkGreen" } else { "Red" } $testStatus = if ($_.Passed) { "--- Passed --- " } else { "*** Failed *** " } if (-not ($Request -and $response)) { $msg = " $($_.TestCase)" $testStatus = $testStatus.PadLeft($host.ui.RawUI.BufferSize.Width - $msg.Length) Write-Host "${Msg}$testStatus" -ForegroundColor $writeColor -NoNewline if ($_.Errors) { Write-Host "$($_.Errors |Out-String)" -ForegroundColor $writeColor } '' } else { " <div style='float:left;width:80%;font-size:1.11em'> <h4> $($_.TestCase) </h4> $(if ($_.Errors) { "<pre> $($_.Errors | Out-String) </pre>" }) </div> <div style='float:right;width:20%;font-size:1.11em;text-align:right'> <span style='font-size:1.11em'>$testStatus</span> </div> <br style='clear:both' /> " } </ScriptBlock> </ExpressionBinding> </CustomItem> </Frame> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </View> <View> <Name>ScriptCop.Test.Pass.Summary</Name> <ViewSelectedBy> <TypeName>ScriptCop.Test.Pass.Summary</TypeName> </ViewSelectedBy> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <Frame> <CustomItem> <ExpressionBinding> <ScriptBlock> $writeColor = if ($_.PercentPassingTestCases -eq 100) { "DarkGreen" } elseif ($_.PercentPassingTestCases -ge 75) { "DarkYellow" } else { "Red" } if (-not ($request -and $response)) { $msg = "$($_.Module)" $testStatus = [Math]::round($_.PercentPassingTestCases, 2) + " % Passed (Test Cases)" $testStatus = $testStatus.PadLeft($host.ui.RawUI.BufferSize.Width - $msg.Length) Write-Host "$msg{$testStatus}" -ForegroundColor $writecolor Write-Host " " $totalTestCasesMsg = "Total Test Cases : $($_.TotalTestCases)".PadRight(($host.ui.Length.rawui.buffersize / 2) -1 ) $passingTestCasesMsg = "$($_.PassingTestCases) ( $([Math]::Round($_.PercentPassingTestCases,2))% Passed".PadLeft(($host.ui.Length.rawui.buffersize / 2) -1) $totalTestPassesMsg = "Total Test Passes : $($_.TotalTestPasses)".PadRight(($host.ui.Length.rawui.buffersize / 2) -1) $passingTestPassesMsg = "$($_.PassingTestPasses) $([Math]::Round($_.PercentPassingTestPasses,2))% Passed".PadLeft(($host.ui.Length.rawui.buffersize / 2) -1) Write-Host "${totalTestCasesMsg}${PassingTestCasesMsg}" -ForegroundColor $writecolor Write-Host "${totalTestPassesMsg}${PassingTestPassesMsg}" -ForegroundColor $writecolor Write-Host " " } else { $summary = $_ $passingTestCasesGraphObject = New-Object PSObject | Add-Member NoteProperty Passed $($summary.PassingTestCases) -Force -PassThru | Add-Member NoteProperty Failed $($summary.TotalTestCases - $summary.PassingTestCases) -Force -PassThru $passingTestPassesGraphObject = New-Object PSObject | Add-Member NoteProperty Passed $($summary.PassingTestPasses) -Force -PassThru | Add-Member NoteProperty Failed $($summary.TotalTestPasses - $summary.PassingTestPasses) -Force -PassThru " <div> <h2>$($_.Module)</h2> <div style='width:40%;margin-left:5%;margin-right:5%;float:left;'> $($passingTestCasesGraphObject | Out-HTML -AsPieGraph -ColorList "#006400", "#800000" -GraphWidth 250 -GraphHeight 250 -Header "Test Cases") </div> <div style='width:40%;margin-left:5%;margin-right:5%;float:left;'> $($passingTestCasesGraphObject | Out-HTML -AsPieGraph -ColorList "#006400", "#800000" -GraphWidth 250 -GraphHeight 250 -Header "Test Passes") </div> <br style='clear:both' /> </div> " } </ScriptBlock> </ExpressionBinding> </CustomItem> </Frame> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </View> <View> <Name>ScriptCop.Command.Coverage.Report</Name> <ViewSelectedBy> <TypeName>ScriptCop.Command.Coverage.Report</TypeName> </ViewSelectedBy> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <Frame> <CustomItem> <ExpressionBinding> <ScriptBlock> if (-not ($request -and $response)) { $_ | Select-Object -Property PercentageCommandCoverage, NumberOfCommandsCovered, TotalNumberOfCommands, OverallParameterCoverage, ParameterCoverageInCoveredCommands, NumberOfParametersCovered, TotalNumberOfParameters | Out-Host '' } else { $summary = $_ $overallCommandCoverage = New-Object PSObject | Add-Member NoteProperty Covered $($summary.NumberOfCommandsCovered) -Force -PassThru | Add-Member NoteProperty Uncovered $($summary.TotalNumberOfCommands - $summary.NumberOfCommandsCovered) -Force -PassThru $coveredCommandParameterCoverage = New-Object PSObject | Add-Member NoteProperty Covered $($summary.NumberOfParametersCovered) -Force -PassThru | Add-Member NoteProperty Uncovered $($summary.CoveredParameterTotal - $summary.NumberOfParametersCovered) -Force -PassThru $totalParameterCoverage = New-Object PSObject | Add-Member NoteProperty Covered $($summary.NumberOfParametersCovered) -Force -PassThru | Add-Member NoteProperty Uncovered $($summary.TotalNumberOfParameters - $summary.NumberOfParametersCovered) -Force -PassThru " <div> <h3>$($_.Module) - Command Coverage</h3> <div style='width:30%;margin-left:2.5%;margin-right:2.5%;float:left;'> $($overallCommandCoverage | Out-HTML -AsPieGraph -ColorList "#006400", "#800000" -GraphWidth 200 -GraphHeight 200 -Header "Overall Command Coverage") </div> <div style='width:30%;margin-left:2.5%;margin-right:2.5%;float:left;'> $($coveredCommandParameterCoverage | Out-HTML -AsPieGraph -ColorList "#006400", "#800000" -GraphWidth 200 -GraphHeight 200 -Header "Parameter Coverage (of Covered commands)") </div> <div style='width:30%;margin-left:2.5%;margin-right:2.5%;float:left;'> $($totalParameterCoverage | Out-HTML -AsPieGraph -ColorList "#006400", "#800000" -GraphWidth 200 -GraphHeight 200 -Header "Overall Parameter Coverage") </div> <br style='clear:both' /> </div> " } </ScriptBlock> </ExpressionBinding> </CustomItem> </Frame> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </View> </ViewDefinitions> </Configuration> |