Ways to concat test results from each of the bazel tests?

247 views Asked by At

I have a build file that runs some Bazel tests , like this on Azure pipeline

jobs:
  - job: "results_extraction"
    timeoutInMinutes: 720

    steps:
      - bash: |
          ./install_conda_environment.sh update
        displayName: "Update conda env"

      - bash: |
          source ${HOME}/.bashrc
          bazel test test1
          --test_output=all
          --test_summary=detailed
        continueOnError: true
        displayName: "Run test1"

      - bash: |
          source ${HOME}/.bashrc
          bazel test test2
          --test_output=all
          --test_summary=detailed
        continueOnError: true
        displayName: "Run test2"

     - task: PublishTestResults@2
          condition: succeededOrFailed()
          inputs:
            testResultsFiles: 'bazel-testlogs/**/*.xml'
            testRunTitle: 'Publish test results.'
          displayName: 'Bazel Tests Publish Results'

But when I go to the bazel-test directory , I cannot find these tests (I looked for test.xml). My guess is bazel sandboxing deletes it but I could be wrong. All I want to do is extract the results of each of these test indiviudal tests. Is there a flag in bazel that allows me to do create a detailed test result containing status of each test?

1

There are 1 answers

0
Brian Silverman On

If you change your tests to write the files to $TEST_UNDECLARED_OUTPUTS_DIR (an environment variable which bazel sets when running tests), the files will be saved at bazel-testlogs/<package>/<target>/test.outputs/outputs.zip. Then, you can write something to gather those up and process them.