You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When specifying the TestSuiteName in the Pester configuration (New-PesterConfiguration) the name is added to object name in element test-results instead of object name the first element test-suite.
I use the following code to generate the Pester configuration
Pester version : 5.2.2 C:\Users\Marc013\OneDrive\Documents\PowerShell\Modules\Pester\5.2.2\Pester.psm1
PowerShell version : 7.1.3
OS version : Microsoft Windows NT 10.0.19043.0
Steps to reproduce
Configure a Pester configuration including TestResult.TestSuiteName. Run Pester defining the configuration and see the results in the XML file.
As a result of this my HTML report that is generated using extentreports-dotnet-cli and ReportUnit do not show the specified test suite name but show Pester instead.
Current result in HTML report
Desired result in HTML report
Possible solution
functionWrite-NUnitReport($Result, [System.Xml.XmlWriter] $XmlWriter) {
# Write the XML Declaration$XmlWriter.WriteStartDocument($false)
# Write Root Element$xmlWriter.WriteStartElement('test-results')
Write-NUnitTestResultAttributes@PSBoundParameters# Write-NUnitTestResultChildNodes @PSBoundParameters ## For some reason this doesn't seem to workWrite-NUnitTestResultChildNodes-RunResult $Result-XmlWriter $XmlWriter$XmlWriter.WriteEndElement()
}
Added to function Write-NUnitTestResultChildNodes: $suiteInfo.name = $RunResult.Configuration.TestResult.TestSuiteName.Value
functionWrite-NUnitTestResultChildNodes($RunResult, [System.Xml.XmlWriter] $XmlWriter) {
Write-NUnitEnvironmentInformation-Result $RunResult-XmlWriter $XmlWriterWrite-NUnitCultureInformation-Result $RunResult-XmlWriter $XmlWriter$suiteInfo=Get-TestSuiteInfo-TestSuite $Result-Path 'Pester'$suiteInfo.name=$RunResult.Configuration.TestResult.TestSuiteName.Value$XmlWriter.WriteStartElement('test-suite')
Write-NUnitTestSuiteAttributes-TestSuiteInfo $suiteInfo-XmlWriter $XmlWriter$XmlWriter.WriteStartElement('results')
foreach ($containerin$Result.Containers) {
if (-not$container.ShouldRun) {
# skip containers that were discovered but none of their tests runcontinue
}
if ('File'-eq$container.Type) {
$path=$container.Item.FullName
}
elseif ('ScriptBlock'-eq$container.Type) {
$path="<ScriptBlock>$($container.Item.File):$($container.Item.StartPosition.StartLine)"
}
else {
throw"Container type '$($container.Type)' is not supported."
}
Write-NUnitTestSuiteElements-XmlWriter $XmlWriter-Node $container-Path $path
}
$XmlWriter.WriteEndElement()
$XmlWriter.WriteEndElement()
}
The text was updated successfully, but these errors were encountered:
Looks like a bug. Please code your solution into a PR targetting the main branch. if you do it soon it will be released with 5.3, which means in few weeks.
General summary of the issue
When specifying the
TestSuiteName
in the Pester configuration (New-PesterConfiguration
) the name is added to object name in element test-results instead of object name the first element test-suite.I use the following code to generate the Pester configuration
Describe your environment
Steps to reproduce
Configure a Pester configuration including
TestResult.TestSuiteName
. Run Pester defining the configuration and see the results in the XML file.Expected Behavior
See
name
in elementtest-suite
Current Behavior
See
name
in elementtest-results
andtest-suite
As a result of this my HTML report that is generated using extentreports-dotnet-cli and ReportUnit do not show the specified test suite name but show Pester instead.
Current result in HTML report
Desired result in HTML report
Possible solution
The text was updated successfully, but these errors were encountered: