Ignore reports from test.check
I haven't tested this out; just made the change via the GitHub web UI.
Doesn't work!
</testcase>{:result true, :num-tests 100, :seed 1500396702425, :test-var "t-task->request-valid-request"}
<testcase name="t-task->request-valid-request"
Reopening this as I think the approach may be sound but we need to maybe change the way the JUnit reporter is configured because there will always be more output on stdout than just the XML.
There shouldn't be; *test-out* should be solely reserved for the test reporters. There may be functions that write to *out*, but that shouldn't affect *test-out* if it's rebound to a file writer.
@weavejester I added an integration test that captures the output from running tests and it looks like this:
lein test :only eftest.report-test/test-junit-reporter
FAIL in (test-junit-reporter) (report_test.clj:10)
expected: (= "" out)
actual: (not (= "" "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites><testsuite name=\"core-test\" package=\"example\"><testcase name=\"b-test\" classname=\"example.core-test\"></testcase><testcase name=\"a-test\" classname=\"example.core-test\"><failure>expected: (= 0 1)\n actual: (not (= 0 1))\n at: core_test.clj:7</failure>\n</testcase></testsuite></testsuites>\nError encountered performing task 'eftest' with profile(s): 'base,system,user,provided,dev,junit'\nTests failed.\n"))
You can see the XML from the JUnit formatter, and then "Error encountered performing task 'eftest'…". Given that we probably always want the JUnit report in a file and not printed to stdout, maybe requiring a path where we write the XML is a good solution?
To enable writing to a file from the Leiningen plugin, two options spring to mind.
The first would be to allow more than just a symbol in the :eftest map in project.clj, and would necessitate changing the require-form and report-namespace fns I think.
(defn- report-namespace [project]
(-> project :eftest (:report 'eftest.report.progress/report) namespace symbol))
(defn- require-form [project]
`(require 'eftest.runner '~(report-namespace project)))
Alternatively, we could add an additional option to the project.clj map of something like :file or :output-path that would be used with eftest.report/report-to-file.
:eftest {:report eftest.report.junit/report
:output-path "target/junit.xml"}
We could even support an environment variable as test2junit does, but I suppose people can use ~(System/getenv "JUNIT_OUTPUT_PATH") from their project.clj.
Maybe you have a better idea?
I like the idea of adding an option, perhaps :output-file, that would wrap the reporter in report-to-file.
I like the idea of adding an option, perhaps :output-file, that would wrap the reporter in report-to-file.
I can use :output-file instead of :report-to-file if you prefer.
See #25 for the ability to redirect test output to a file, which will be useful here too.