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

test2junit 1.3.2 breaks when reflection warnings printed during test execution #14

Open
err opened this issue Jun 3, 2017 · 2 comments

Comments

@err
Copy link

err commented Jun 3, 2017

clj-assorted-util does not provide an implementation of the 3-arity method of java.io.StringWriter. Any tests which cause warnings to be printed by the clojure compiler at runtime might cause test2junit to fail.

example error output

As produced by sample project:

Writing output to: test2junit

Testing: t2j-err.core-test
Running tests in: t2j-err.core-test
  Running test: #'t2j-err.core-test/a-test-creates-reflection-warning
    ERROR
      Message: clojure.lang.ArityException: Wrong number of args (4) passed to: core/apply-junit-output-hook/fn--253/fn--254, compiling:((...)/form-init4255135209920479730.clj:6:21)
      Cause: #error {
 :cause Wrong number of args (4) passed to: core/apply-junit-output-hook/fn--253/fn--254
 :via
 [{:type clojure.lang.ArityException
   :message Wrong number of args (4) passed to: core/apply-junit-output-hook/fn--253/fn--254
   :at [clojure.lang.AFn throwArity AFn.java 429]}]
 :trace
 [[clojure.lang.AFn throwArity AFn.java 429]
  [clojure.lang.AFn invoke AFn.java 44]
  [test2junit.core.proxy$java.io.StringWriter$ff19274a write nil -1]
  [java.io.PrintWriter write PrintWriter.java 456]
  [java.io.PrintWriter write PrintWriter.java 473]
  [java.io.PrintWriter append PrintWriter.java 1004]
  [java.io.PrintWriter append PrintWriter.java 56]
  [java.util.Formatter$FixedString print Formatter.java 2595]
  [java.util.Formatter format Formatter.java 2508]
  [java.io.PrintWriter format PrintWriter.java 905]
  [clojure.lang.Compiler$InstanceFieldExpr <init> Compiler.java 1157]
  [clojure.lang.Compiler$HostExpr$Parser parse Compiler.java 998]
  [clojure.lang.Compiler analyzeSeq Compiler.java 6868]
  [clojure.lang.Compiler analyze Compiler.java 6669]
  [clojure.lang.Compiler analyze Compiler.java 6625]
  [clojure.lang.Compiler$BodyExpr$Parser parse Compiler.java 6001]
  [clojure.lang.Compiler$FnMethod parse Compiler.java 5380]
  [clojure.lang.Compiler$FnExpr parse Compiler.java 3972]
  [clojure.lang.Compiler analyzeSeq Compiler.java 6866]
  [clojure.lang.Compiler analyze Compiler.java 6669]
  [clojure.lang.Compiler eval Compiler.java 6924]
  [clojure.lang.Compiler eval Compiler.java 6890]
  [clojure.core$eval invokeStatic core.clj 3105]
  [clojure.core$eval invoke core.clj 3101]
  [t2j_err.core_test$fn__486 invokeStatic core_test.clj 6]
  [t2j_err.core_test$fn__486 invoke core_test.clj 4]
@ruedigergad
Copy link
Owner

Hey,

thanks a lot for spotting the issue and for the excellent investigation and documentation!

I already replied to the pull request regarding clj-assorted-utils separately.
I merged your changes to clj-assorted-utils and uploaded a new version.
Based on the new clj-assorted-utils version, I also uploaded a new test2junit version (1.3.3).

Also thanks a lot for the minimal working example for re-producing the error.
Is it fine for you if I include your test case
https://github.com/err/t2j-err/blob/master/test/t2j_err/core_test.clj
in the test2junit unit tests?

Also, please let me know if the new test2junit version fixes the issue for you.

Thanks a lot again and cheers,

Ruediger

@err
Copy link
Author

err commented Jun 23, 2017

Is it fine for you if I include your test case [...] in the test2junit unit tests?

Absolutely!
The new test2junit version (1.3.3) does fix this issue.
Thank you!


I have noticed one thing. Possibly unrelated.

For the following test:

(deftest intentionally-failing-test
   (testing "all things"
     (prn "Bwahaha!")
     (is false)
     (prn "A test just failed.")))

I see this in my test report:


Standard Output

34661199710497104973334
3465321161011151163210611711511632102971051081011004634
    

Which I believe is just the ASCII character codes:

user> (map #(apply str (map int %))
              [(pr-str "Bwahaha")
               (pr-str "A test just failed.")])
;; => ("346611997104971049734"
       "3465321161011151163210611711511632102971051081011004634")

I have not yet had time to investigate further. I am not familiar with JUnit; maybe there's some configuration I need to adjust. If anyone has suggestions as to where to begin my search, I'm happy to follow through on this.

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