Criteria for junit test metadata, not picking up w/ clojure/boot?


#1

How does Circle pick up on test metadata? I’m using clojure and boot, and have it outputting junit reports to $CIRCLE_TEST_REPORTS/junit. The files are named after namespaces, not the test files, for example myapp.test.server-test.xml and the files look normal.

A test run under “Collecting Test Metadata” shows

Compressing test results...
Uploading test results...
Test results uploaded.

But Circle is still prompting me to “Set up Test Summary”. Any ideas? If is was successfully picking up the reports, would I witness different behavior? I’d really like to get this working to enable auto-parallelizaiton.


#2

It sounds like everything should be working. Can you open a ticket in the support app so we can take a look at the project and results files?

If this is not a paid org, can you DM me the org/project URL on CircleCI so we can look?


#3

Did you get this working? I’m setting up a clojure project on circle and having directions for this would be cool! Thanks.


#4

Heya,

Sorry folks, I had gotten it working and then got busy with other things. The project is private, but here’s the relevant bits:

circle.yml

test:
  override:
    - ./script/test-ns:
        parallel: true
        files:
          - test/**/*_test.clj
          - test/**/*_test.cljc
    - boot test-cljs
  post:
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - find . -type f -regex ".*/target/reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

script/test-ns

#!/usr/bin/env bash

# converts `src/clj/namespace/to/some_file.clj` to `namespace.to.some-file`
file_to_ns () {
    echo $(echo "$1" \
               | sed -e 's|test/clj\w*/||' \
               | sed -e 's|.clj\w*$||' \
               | sed -e 's|/|.|g' \
               | sed -e 's|_|-|g')
}

nss=""

for f in $*; do
    nss+="-n $(file_to_ns $f) "
done

boot test-env \
     test -j "reports" \
     $nss \
     target -d  target

There were three things I didn’t quite understand:

  1. Circle expects the directory containing the junit-style output to be in a directory called “junit”
  2. boot-test puts those files in a subdirectory of the target
  3. you cannot use $CIRCLE_TEST_REPORTS as your boot compile target if you want this to work.

#5