0

The question

Is it possible to pass a general $(location) to bazel test in the --test_args argument which is re-evaluated for each executed test?

Context

What I am trying to do is use bazel test to bulk execute tests, but produce unique output files.

I am using Catch2 with the --out argument to specify a JUnit XML output file location. I could have Catch2 output the JUnit to STDOUT, but the test.log gets somewhat polluted with test data produced by Bazel, and any other STDOUT, or STDERR that Catch2 produces.

eg. I am trying to produce the following:

  • ./bazel-testlogs/
    • Folder
      • Tests
        • Test1
          • Test1_JUNIT.xml
        • Test2
          • Test2_JUNIT.xml

1 Answers1

0

We ended up patching Catch2 to look for the XML_OUTPUT_FILE environment variable, and use that as the report output path. The inspiration came from this similar post.