Skip to content

Commit

Permalink
Publish xctest result for screenshots and diagnostic logs (#2306)
Browse files Browse the repository at this point in the history
* Publish xctest result for screenshots

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* add attempts

* update

* update yml file to use original junit file path

* update copy file process

* generate test result in original places

* copy testResults

* fix yaml file indent error

* add generating xchtmlreport process for published artifacts

* remove useless task

* update:
  • Loading branch information
KangxuanYe committed May 21, 2024
1 parent 11616ac commit 843454e
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions tools/yaml-templates/ios-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ steps:
targetType: inline
script: |
brew install xctesthtmlreport
workingDirectory: '$(System.DefaultWorkingDirectory)'
workingDirectory: '$(Agent.BuildDirectory)/iOSHost'
condition: always()

- task: NodeTool@0
inputs:
Expand Down Expand Up @@ -90,19 +91,40 @@ steps:

- task: Bash@3
displayName: 'Generate E2E test report'
condition: succeededOrFailed()
inputs:
targetType: inline
script: |
xchtmlreport -r TestResults -j; if [[ $? == 0 ]]; then echo "Test report has been generated successfully."; exit 0; else echo "Test report generating process failed for some reasons."; exit 1; fi;
workingDirectory: '$(Agent.BuildDirectory)/iOSHost'
condition: always()

- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFiles: '**/*.junit'
failTaskOnFailedTests: false
testRunTitle: 'E2E Tests - iOS'
testRunTitle: 'E2E Tests - $(agent.JobName)'
searchFolder: '$(Agent.BuildDirectory)/iOSHost'
mergeTestResults: true
condition: succeededOrFailed()

- bash: |
output="$(agent.buildDirectory)/Logs/$(agent.JobName)"
rm -rf "${output}" > /dev/null
mkdir -p "${output}"
cp -r $(Agent.BuildDirectory)/iOSHost/TestResults "${output}/output.xcresult"
xchtmlreport -r ${output}/output.xcresult -j
echo "ls -lR ${output}"
ls -lR "${output}"
displayName: Preparations for publishing results
condition: always()
- task: 1ES.PublishPipelineArtifact@1
inputs:
path: '$(agent.buildDirectory)/Logs'
artifact: iOSDebugLogs - ${{ parameters.testPlan }} - Attempt $(System.JobAttempt)
condition: always()

0 comments on commit 843454e

Please sign in to comment.