CapnKernul/minitest-reporters — pull request #13 by bensomers (2012-04-11 23:58:01+00:00)
Title: JUnit XML reporter

Here's a functional-as-far-as-I-have-tested-it JUnit reporter! I attempted to use the RubyMineReporter for my TeamCity projects, but couldn't get around its performance problems. I looked into rb2k@e13d95b5f884453a9c77f62bc5cba3fa1df30ef5, but found a few things I wanted to change about it.

Notably, I swapped out hand-made xml for xml made with builder - this regrettably increases the footprint quite a bit, but it gives us intelligent and reliable xml generation (and more importantly, xml escaping). I copied a couple of features over from ci_reporter, as well; mostly its habit of paying attention to duplicate test names and working around them.

KNOWN ISSUES:
1. No tests. Looks like none of the other reporters have tests yet either, so I'm not too worried about this, but I may try to add some later this week if I can swing the time.
2. Not DRY. Duplicates some code from the DefaultReporter (namely, the #message_for and #location methods). Might I suggest a refactoring, pulling a few methods out of DefaultReporter and into a BaseReporter, that can be inherited from? I can also work on this if desired.
3. Will overwrite report data if 100+ duplicate testnames. Honestly, this is the user's fault.
4. May discard some report data if using parallel_tests and having extremely unbalanced test run times. If one thread has finished very quickly, and written its reports, a second thread might empty the reports directory on startup and delete the reports. The correct solution would be to empty the reports dir before forking the test threads; I expect this is why ci_reporter does it in a separate rake task. Still, it's a tough edge case to get yourself into, so I may put off addressing this until there's a demonstrated need (which is honestly more likely to happen with my team than most :p).