Get-ModuleTestFailures
Analyzes and summarizes failed Pester tests from either a Pester results object or an NUnit XML result file.
Syntax
Get-ModuleTestFailures [-OutputFormat <Summary|Detailed|Json>] [-PassThru] [-Path <String>] [-ProjectPath <String>] [-ShowSuccessful] [<CommonParameters>]#PathGet-ModuleTestFailures [-OutputFormat <Summary|Detailed|Json>] [-PassThru] [-ProjectPath <String>] [-ShowSuccessful] -TestResults <Object> [<CommonParameters>]#TestResultsDescription
This cmdlet is designed to make CI output and local troubleshooting easier by summarizing failures from:
Use -OutputFormat to control whether the cmdlet writes a concise host summary, detailed messages, or emits JSON to the pipeline.
Examples
Analyze test failures from the default results location
Get-ModuleTestFailuresSearches for TestResults.xml under the project and prints a detailed failure report.
Analyze failures from a specific NUnit XML file
Get-ModuleTestFailures -Path 'Tests\TestResults.xml' -OutputFormat SummaryWrites a compact summary that is suitable for CI logs.
Pipe results from Invoke-ModuleTestSuite
Invoke-ModuleTestSuite -ProjectPath 'C:\Git\MyModule' | Get-ModuleTestFailures -OutputFormat Detailed -PassThruUses the in-memory results and returns the analysis object for further processing.
Parameters
- -OutputFormat ModuleTestFailureOutputFormat
- Format for displaying test failures.
- Possible values:
Summary,Detailed,Json - -PassThru SwitchParameter
- Return the failure analysis object for further processing.
- -Path String
- Path to the NUnit XML test results file. If not specified, searches for TestResults.xml under ProjectPath.
- -ProjectPath String
- Path to the project directory used to locate test results when Path is not specified.
- -ShowSuccessful SwitchParameter
- Include successful tests in the output (only applies to Summary format).
- -TestResults Object
- Pester test results object from Invoke-Pester, a ModuleTestSuiteResult from Invoke-ModuleTestSuite, or a precomputed ModuleTestFailureAnalysis.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.