Skip to content

Commit 797ffb6

Browse files
🩹 [Refactor]: Enhance XML processing in workflow script to extract and log test case details
1 parent 4a196a7 commit 797ffb6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎.github/workflows/workflow.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,29 @@ jobs:
208208
$files = Get-ChildItem -Path . -Recurse -File
209209
$files | Format-Table -AutoSize | Out-String
210210
211+
$allCases = [System.Collections.Generic.List[psobject]]::new()
211212
foreach ($file in $files) {
212213
$fileName = $file.BaseName
213214
LogGroup $fileName {
214215
Get-Content -Path $file | Out-String
215216
}
217+
LogGroup "$fileName - Process" {
218+
$xmlDoc = [xml](Get-Content $_.FullName)
219+
$cases = $xmlDoc.SelectNodes('//test-case') | ForEach-Object {
220+
[pscustomobject]@{
221+
Name = $_.name
222+
Description = $_.description
223+
Result = $_.result
224+
Success = [bool]($_.success -eq 'True')
225+
Time = [float]$_.time
226+
Executed = [bool]($_.executed -eq 'True')
227+
FailureMessage = $_.failure.message
228+
StackTrace = $_.failure.'stack-trace'
229+
}
230+
}
231+
$cases | ForEach-Object { $allCases.Add($_) }
232+
$cases | Format-Table -AutoSize | Out-String
233+
}
216234
}
217235
218236
# Get-CodeCoverage:

0 commit comments

Comments
 (0)