change: refactored test output and created new functions

This commit is contained in:
DrIOS
2024-06-06 14:38:19 -05:00
parent 8446d101a7
commit 4bc1f8fdda
57 changed files with 617 additions and 269 deletions

View File

@@ -76,6 +76,13 @@ function Test-AntiPhishingPolicy {
}
catch {
Write-Error "An error occurred during the test: $_"
# Retrieve the description from the test definitions
$testDefinition = $script:TestDefinitionsObject | Where-Object { $_.Rec -eq $recnum }
$description = if ($testDefinition) { $testDefinition.RecDescription } else { "Description not found" }
$script:FailedTests.Add([PSCustomObject]@{ Rec = $recnum; Description = $description; Error = $_ })
# Call Initialize-CISAuditResult with error parameters
$auditResult = Initialize-CISAuditResult -Rec $recnum -Failure
}