Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit formatter doesn't play nice with test.check #17

Open
jcf opened this issue Jul 18, 2017 · 7 comments
Open

JUnit formatter doesn't play nice with test.check #17

jcf opened this issue Jul 18, 2017 · 7 comments

Comments

@jcf
Copy link
Contributor

jcf commented Jul 18, 2017

Hey James,

Because both the JUnit formatter and test.check print to test out you end up with hash maps in the XML output.

[snip]
</testcase>{:result true, :num-tests 100, :seed 1500392295920, :test-var "t-params->map-keys"}
<testcase name="t-params-&gt;map-keys" classname=[snip]

Maybe logging to a file will work from the REPL, but there's not option to log to a file when configuring lein-eftest as far as I can see.

I can maybe throw together a PR this week if you have a preferred solution in mind.

@weavejester
Copy link
Owner

How is test.check printing these things? A cursory look at the source code suggests its doing so via the test reporter, so couldn't we add methods for the extra events that test.check generates?

@jcf
Copy link
Contributor Author

jcf commented Jul 18, 2017

That we could. I was just looking into adding something to my own codebase, but ultimately maybe that belongs in eftest?

@jcf
Copy link
Contributor Author

jcf commented Jul 18, 2017

It looks like these are the events emitted by test.check:

  • :clojure.test.check.clojure-test/trial
  • :clojure.test.check.clojure-test/shrinking
  • :clojure.test.check.clojure-test/shrunk

@weavejester
Copy link
Owner

In theory we could extend the current Eftest reporter multimethods with support for the extra test.check events. For the junit reporter, presumably we just want to ignore them.

@jcf
Copy link
Contributor Author

jcf commented Jul 18, 2017

For the junit reporter, presumably we just want to ignore them.

I guess so. If you're using clojure.test.check.clojure-test/defspec the test failures will be reported via clojure.test itself as you can see if the XML snippet I posted above.

For the other multimethods you refer to, I'm not sure. I always use defspec but maybe others want the test.check reports to show up somewhere?

@weavejester
Copy link
Owner

For now, what about ignoring the reports for the junit reporter, and just deferring to the default for the others (which should require no change?). That would solve the immediate problem of bad data in the junit output.

@jcf jcf closed this as completed Jul 18, 2017
@jcf jcf reopened this Jul 18, 2017
@jcf
Copy link
Contributor Author

jcf commented Jul 18, 2017

Whoops! Sorry. I'll add the test.check events to the JUnit reported via GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants