albal has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script for several test cases which are written in C, and I am using command line to run this perl script to execute test cases. The result of these test cases are stored in a text file. Now, I am interested to produce JUnit like XML output for these test cases. I tried with TAP::Formatter::JUnit but it didn't work for me. Someone please help me how can I generate Junit XML log files for my test cases. To summerise: Test cases are written in C, Perl script for executing these test cases on the target, results are stored in the Text file. Now I need JUnit like XML output instead of text output. P.S I am new to perl, my question may look simple/silly for you guys. But some help from you is much appreciated.

Replies are listed 'Best First'.
Re: JUnit XML log
by Discipulus (Canon) on Jun 23, 2015 at 10:55 UTC

      Hi Discipulus, Thanks you, I am already thinking to try with XML::Twig Let me see, what I will get from it. Thanks for the tip..

Re: JUnit XML log
by marinersk (Priest) on Jun 23, 2015 at 10:50 UTC

    Even a small snippet of code showing what you tried will improve the odds notably that we might be able to guide you to your answer.

      Hi marinersk, Thank you for your reply. It is actually a big script that generates text files as i said. IS there a Perl script that produces JUnit XML? I mean the source file, because I tried with CPAN modules already.

Re: JUnit XML log
by jeffa (Bishop) on Jun 23, 2015 at 17:24 UTC

    Rather than trying to do something with the existing test results, just run new test cases and filter your output:

    prove -rl --formatter=TAP::Formatter::JUnit --timer t/| tee junit.xml

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)