ConvertTo-NUnitReport
Contributions are welcome in Pester-repo.
SYNOPSIS
Converts a Pester result-object to an NUnit 2.5 or 3-compatible XML-report
SYNTAX
ConvertTo-NUnitReport [-Result] <Run> [[-Format] <string>] [-AsString]
DESCRIPTION
Pester can generate a result-object containing information about all tests that are processed in a run. This objects can then be converted to an NUnit-compatible XML-report using this function. The report is generated using either the NUnit 2.5 or 3-schema.
The function can convert to both XML-object or a string containing the XML. This can be useful for further processing or publishing of test results, e.g. as part of a CI/CD pipeline.
EXAMPLES
EXAMPLE 1
$p = Invoke-Pester -Passthru
$p | ConvertTo-NUnitReport
This example runs Pester using the Passthru option to retrieve the result-object and converts it to an NUnit 2.5-compatible XML-report. The report is returned as an XML-object.
EXAMPLE 2
$p = Invoke-Pester -Passthru
$p | ConvertTo-NUnitReport -Format NUnit3
This example runs Pester using the Passthru option to retrieve the result-object and converts it to an NUnit 3-compatible XML-report. The report is returned as an XML-object.
EXAMPLE 3
$p = Invoke-Pester -Passthru
$p | ConvertTo-NUnitReport -AsString
This example runs Pester using the Passthru option to retrieve the result-object and converts it to an NUnit 2.5-compatible XML-report. The returned object is a string.
PARAMETERS
-AsString
Returns the XML-report as a string.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Format
Specifies the NUnit-schema to be used.
Type: System.String
DefaultValue: NUnit2.5
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Result
Result object from a Pester-run. This can be retrieved using Invoke-Pester -Passthru or by using the Run.PassThru configuration-option.
Type: Pester.Run
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
Pester.Run
OUTPUTS
System.Xml.XmlDocument
System.String
NOTES
RELATED LINKS
- https://pester.dev/docs/commands/ConvertTo-NUnitReport
- https://pester.dev/docs/commands/Invoke-Pester
VERSION
This page was generated using comment-based help in Pester 6.0.0.