[fpc-devel] jUnit output for fpcunit

Michael Van Canneyt michael at freepascal.org
Wed Dec 29 16:25:33 CET 2021



On Wed, 29 Dec 2021, Joost van der Sluis via fpc-devel wrote:

>
> Op 29-12-2021 om 16:05 schreef Michael Van Canneyt via fpc-devel:
>> 
>> On Wed, 29 Dec 2021, Joost van der Sluis via fpc-devel wrote:
>>>
>>> I'm trying to run my fpcunit unit-tests on Gitlab, and let Gitlab show 
>>> the results. But it can only handle JUnit-like xml.
>>>
>>> Does someone already have something lying around to convert the 
>>> fpcunit format into junit?
>> 
>> Is the FPCUnit format very different from the JUnit one ? Because 
>> fpcunit is based on junit.
>
> Well, they are similar, but not similar enough.
>
> fpcunit:
>
> <?xml version="1.0" encoding="utf-8"?>
> <TestResults>
>   <!-- Generated using FPCUnit on 2021-12-29 15:02:32-->
>   <TestListing>
>     <TestSuite Name="" ElapsedTime="00:00:16.471" NumberOfErrors="0" 
> NumberOfFailures="6" NumberOfRunTests="29" NumberOfIgnoredTests="0">
>       <TestSuite Name="TDABTestRunBasics" ElapsedTime="00:00:03.598" 
> NumberOfErrors="0" NumberOfFailures="2" NumberOfRunTests="10" 
> NumberOfIgnoredTests="0">
>         <Test Name="TestInitialize" Result="OK" 
> ElapsedTime="00:00:00.211"/>
>       </TestSuite>
>     </TestSuite>
>   </TestListing>
>   <Title>FPCUnit Console test runner</Title>
>   <NumberOfRunTests>29</NumberOfRunTests>
>   <NumberOfErrors>0</NumberOfErrors>
>   <NumberOfFailures>6</NumberOfFailures>
>   <NumberOfIgnoredTests>0</NumberOfIgnoredTests>
>   <TotalElapsedTime>00:00:16.473</TotalElapsedTime>
>   <DateTimeRan>2021-12-29 15:02:48</DateTimeRan>
> </TestResults>
>
> junit:
>
> <testsuite tests="3">
>     <testcase classname="foo1" name="ASuccessfulTest"/>
>     <testcase classname="foo2" name="AnotherSuccessfulTest"/>
>     <testcase classname="foo3" name="AFailingTest">
>         <failure type="NotEnoughFoo"> details about failure </failure>
>     </testcase>
> </testsuite>
>
> If nothing exists already, I can add it as a format to fpcunit.

Yes. I suspect you can take the existing XML listener and adapt it easily
enough...

Michael.


More information about the fpc-devel mailing list