Fork me on GitHub

Hello 🙂 I am about to lose hope that what I'm attempting to do is not possible "out of the box". I've been through many SO-posts, github projects and many hours of Googling. I'm new to Clojure testing and was hoping to be able to write end-to-end tests. I'm having small successes in that I have managed to get some form of usable output to junit XML. Getting "pretty" results through junit2html, junit-viewer or allure reports at this time seem like something that is not done all that much, due to the near non-existent material that I can gather. Is this pretty much uncharted territory or do I need to lower my expectations? 😄


What’s the problem you’re having?


I’ve previously used a Leiningen plugin (I think it was, but it might’ve been something else) to produce a jUnit XML report out of a Clojure test run. I’d imagine you could just pipe those XML documents into your jUnit XML -> HTML report generator of choice, but I have zero experience with that sort of thing, so I might be wrong.


I think my problem is inexperience TBH. By using defaults in all situations there is not a lot of information ending up in the output XML, with the result that the pretty reports I'm trying to get doesn't look like much. For example, having a look at what junit-viewer is capable of generating, it looks pretty good, but my generated XML does not result in the same awesomeness. I'm struggling to find exactly what I need to tweak to get more out, into the XML.


I've come across redbadger several times now but skipped it. So far I've tried standard clojure.test.junit and eftest . I get the same results, which points to my previous suspicion of having to dig deeper to understand reporting/report generation from Clojure better.


Ah, right — I forgot about clojure.test.junit. Yeah, I have no experience there, I’m afraid.


Alright 😄 I'll 🤞 and dig around a bit more. I really dread to go redo this in Java 😰


FWIW Kaocha also has a junit XML plugin feedback for this is very much welcome. The problem with junit.xml is that it's less of a standard than it seems, there are big differences in how tools interpret the results...


@U1M0BC7S7 I don't think many Clojure folks bother with the jUnit XML stuff. What do you think you need that for?


(context: I've worked with Clojure in production for nine years and never needed to produce XML output from tests)


Also, what exactly do you mean by "end-to-end" tests? To me, that typically means driving the application using something like HtmlUnit or WebDriver...? We use HtmlUnit now but we used to clj-webdriver (no longer maintained).


@U04V70XH6 Thank you for your feedback, I will have a look at Kaocha too. I've done some digging around and found the XSD for xUnit/JUnit format, unofficial though - like you say, it's less of a standard. Well, the reason why I'm looking at JUnit report output is because it appears that most of the fancy dashboard/html-generation utilities out there handle it in some way or another. After looking at the XSD, there really isn't much to it, I just don't yet know how to get the attributes written to the file (like duration - everything is 0.0). So what I mean by end-to-end is close to what you have. I don't have it figured out yet... The existing legacy spaghetti-base did everything, or attempted, to do API and UI testing in one pass, using ExtentReports for screenshots and having quite verbose logging to System.out I've inherited a Java codebase where one of the largest files is a Java class of 8000 lines of code and no development principles to be mentioned. There are so many articles and definitions of the different levels and kinds of testing that it becomes a blur. I thought I knew enough about testing when I took on this project but I was wrong.


I feel like I'm rambling, I apologise. I'm just trying to grok testing in Clojure 😅 I have the basics down in writing the tests and I had several a-ha moments. I just didn't discover them all yet.


Sounds like quite the nightmare project -- good luck! 🙂 I hadn't thought about dashboards but, yeah, that makes sense.


I remembered after posting this that I did, at one point in the distant past, actually try to go down the XML generation route for some piece of a project we had at work... and I don't believe the supposedly jUnit-compatible viewer that we used understood the XML output from clojure.test.junit... but my memory is a bit hazy.


There's also "tap" output I believe, so maybe that format would work better with your dashboard tools?


I'll definitely have a look, thank you. The more I read about clojure.test and the other tools that hook into it, the more I sense that all the dots are there, I just need to connect them.


Kaocha is intriguing!


Anyway, I'm done for the day, need to recharge my mind. Thanks for the help!