From b687ab546ed4db1dff5004060b69af3a16c8e23a Mon Sep 17 00:00:00 2001 From: Bill Wert Date: Thu, 19 Dec 2024 17:25:27 -0800 Subject: [PATCH 1/4] Fix up test names for reporting The web view in AzDo pulls the ame out of the results XML, which can be duplicative or unsatisfying in other ways. This will process the XML to put a bread crumb of the namespace and the type along with the test name. --- eng/pipelines/templates/steps/build-and-test.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/eng/pipelines/templates/steps/build-and-test.yml b/eng/pipelines/templates/steps/build-and-test.yml index 55324a4241fb9..bd6858488602e 100644 --- a/eng/pipelines/templates/steps/build-and-test.yml +++ b/eng/pipelines/templates/steps/build-and-test.yml @@ -252,6 +252,21 @@ steps: - template: /eng/pipelines/templates/steps/retain-test-logs.yml - template: /eng/pipelines/templates/steps/retain-heap-dump-hprofs.yml + # The name of a test case in the results file isn't helpful in the web view. + # Update it to include the breadcrumb namespace and the type. + - pwsh: | + Get-ChildItem "TEST-*.xml" -Path | ForEach-Object { + [xml]$xml = Get-Content $_.FullName + $xml.SelectNodes("//testcase") | ForEach-Object { + $parts = $_.classname -split '\.' + $shortClassname = (($parts[0..($parts.Length -2)] | ForEach-Object { $_[0] }) -join ".") + ".$($parts[-1])" + $_.name = "$shortClassname.$($_.name)" + } + $xml.Save($_.FullName) + } + displayName: 'Update test case names for reporting' + workingDirectory: $(System.DefaultWorkingDirectory)/sdk + - task: PublishTestResults@2 condition: always() inputs: From 5b0a7a824e9e3bbfb380a946e93b91fdc8b5e3b9 Mon Sep 17 00:00:00 2001 From: Bill Wert Date: Thu, 19 Dec 2024 17:39:08 -0800 Subject: [PATCH 2/4] remove extraneous -Path --- eng/pipelines/templates/steps/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/build-and-test.yml b/eng/pipelines/templates/steps/build-and-test.yml index bd6858488602e..7021154582e8a 100644 --- a/eng/pipelines/templates/steps/build-and-test.yml +++ b/eng/pipelines/templates/steps/build-and-test.yml @@ -255,7 +255,7 @@ steps: # The name of a test case in the results file isn't helpful in the web view. # Update it to include the breadcrumb namespace and the type. - pwsh: | - Get-ChildItem "TEST-*.xml" -Path | ForEach-Object { + Get-ChildItem "TEST-*.xml" | ForEach-Object { [xml]$xml = Get-Content $_.FullName $xml.SelectNodes("//testcase") | ForEach-Object { $parts = $_.classname -split '\.' From e0dd42d22846d50b3ac5875d72e431e007ab9765 Mon Sep 17 00:00:00 2001 From: Bill Wert Date: Thu, 19 Dec 2024 20:45:04 -0800 Subject: [PATCH 3/4] testing --- eng/pipelines/templates/steps/build-and-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/pipelines/templates/steps/build-and-test.yml b/eng/pipelines/templates/steps/build-and-test.yml index 7021154582e8a..125454487f40b 100644 --- a/eng/pipelines/templates/steps/build-and-test.yml +++ b/eng/pipelines/templates/steps/build-and-test.yml @@ -255,7 +255,9 @@ steps: # The name of a test case in the results file isn't helpful in the web view. # Update it to include the breadcrumb namespace and the type. - pwsh: | + echo "Current directory: $(get-location)" Get-ChildItem "TEST-*.xml" | ForEach-Object { + echo "Updating $($_.Name)" [xml]$xml = Get-Content $_.FullName $xml.SelectNodes("//testcase") | ForEach-Object { $parts = $_.classname -split '\.' @@ -274,6 +276,7 @@ steps: testResultsFiles: '**/TEST-*.xml' searchFolder: '$(System.DefaultWorkingDirectory)/sdk' mergeTestResults: true + publishRunAttachments: true # just for debugging ${{ if eq(parameters.TestVersionSupport, 'true') }}: testRunTitle: '$(Agent.JobName)_vo_${{ parameters.VersionOverride }}_attempt_$(System.JobAttempt)' ${{ else }}: From 7e0a15d2a8c7ac97a46733285af029ddd42b4ddf Mon Sep 17 00:00:00 2001 From: Bill Wert Date: Fri, 20 Dec 2024 12:56:42 -0800 Subject: [PATCH 4/4] pr feedback --- eng/pipelines/templates/steps/build-and-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/build-and-test.yml b/eng/pipelines/templates/steps/build-and-test.yml index 125454487f40b..da91ca8fbff96 100644 --- a/eng/pipelines/templates/steps/build-and-test.yml +++ b/eng/pipelines/templates/steps/build-and-test.yml @@ -256,7 +256,7 @@ steps: # Update it to include the breadcrumb namespace and the type. - pwsh: | echo "Current directory: $(get-location)" - Get-ChildItem "TEST-*.xml" | ForEach-Object { + Get-ChildItem "TEST-*.xml" -Recurse | ForEach-Object { echo "Updating $($_.Name)" [xml]$xml = Get-Content $_.FullName $xml.SelectNodes("//testcase") | ForEach-Object { @@ -276,7 +276,6 @@ steps: testResultsFiles: '**/TEST-*.xml' searchFolder: '$(System.DefaultWorkingDirectory)/sdk' mergeTestResults: true - publishRunAttachments: true # just for debugging ${{ if eq(parameters.TestVersionSupport, 'true') }}: testRunTitle: '$(Agent.JobName)_vo_${{ parameters.VersionOverride }}_attempt_$(System.JobAttempt)' ${{ else }}: