0

I've got a couple of txt files that are generated from our application for automated testing purposes. Inside these text files there are 3 possible values: pass, failed and crashed.

Based on these results I have to create some Jenkins reports at the end of the automated tests, in order to have an idea about what is going on. How many tests passed/failed, using charts and so on.

I do know that the best way to do this is using the JUnit Report plugin, but that would mean I have to convert all these text files into one XML file.

How could I do this the easiest way?

TL;DR How to parse values from multiple text files inside a xml file supported by Jenkins' JUnit Report plugin

  • I don't know of any ready-made tool/lib that is doing that. I am in a similar situation and I will probably try to program it myself (in Python I think). In your case, if you are ready to do it yourself, the way to do it depends on the format of your tests results text files... and the programming langage you are willing to use to parse your files and produce a Jenkins compatible file. This thread could help you gather informations about the XML JUnit format file : https://stackoverflow.com/questions/4922867/what-is-the-junit-xml-format-specification-that-hudson-supports – Laurent Bristiel Feb 05 '20 at 07:13
  • You don't need to explicitly take care of that, most test frameworks support different formatters. For example, mocha can output your suite execution https://mochajs.org/#xunit as xml and all you need to do is pipe it to the Jenkins reporter plugin. – ekostadinov Feb 05 '20 at 11:30
  • It's not really clear to me how I could feed values from text files to mocha in order to generate a xml for Jenkins. @ekostadinov have you ever done this/could you offer some insight on it? – SBlackheart Feb 07 '20 at 15:06
  • As per your question the `txt files that are generated from our application for automated testing` are not actual input, right? Rather, the test runner itself created them. Maybe, we need some more clarity here. – ekostadinov Feb 10 '20 at 05:08
  • Alright so, the text files are generated by calling our app's exe with a certain parameter. I give an input for the app to test and then, I get an output (again from the app) which is these text files with the 3 possible values from above pass, failed and crashed. For each input I give for the app to automatically test, I get a different text file. So I can end up with something like 20 different text files, 10 of them saying pass, the other 10 saying failed. And these are the values I have to somehow parse into this xml file compatible with jenkins. – SBlackheart Feb 10 '20 at 09:12

0 Answers0