Fork me on GitHub
#testing
<
2023-05-12
>
Eugen07:05:43

[SOLVED] with hack. hi, can I register some tests / test results dynamically so they are run when I run tests ? Context: Looking to register junit 3 TestSuite with clojure test runner. I am trying to test a java collection implementation using Guava testlib. I implemented this collection tests in clojue, for my map implementation: https://github.com/eclipse/eclipse-collections/issues/1196 . guava-testlib generates tests using junit3 code that I can run manually and I get back a junit.framework.Testresult. How can I run those tests integrated with clojure test framework (no prefference) and have failures reported back on completion.

(let [result (TestResult.)
        my-supplier (reify Supplier (get [_this]  .... )))
        suite (generate-map-test-suite "hash-map" my-supplier)
        _ (.run suite result)
        r (test-result-info result)]) 
test-results-info extracts data from TestResults and gives me:
{:was-successful false, :run-count 955, :fail+error 929, :error-count 915, :failure-count 14}

Eugen09:05:38

I managed to "solve" this by running the tests inside a deftest, getting the TestResult with the counts and testing the counts match my expected counts (0 errors, 0 failures). I am running 600 collection tests in 1 deftest - which is not ideal but it works.