Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-12

jUnit output for fpcunit

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joost van der Sluis

Hi all,

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?

Regards,

Joost.

Reply by email

Joost van der Sluis
to Florian Klämpfl

Op 29-12-2021 om 15:35 schreef Florian Klämpfl via fpc-devel:

Show quoted text 12 lines
Am 29.12.2021 um 14:50 schrieb Joost van der Sluis via fpc-devel: > 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? > I assume https://gitlab.com/freepascal.org/fpc/source/-/blob/main/tests/utils/fpts2junit.pp is not what you want?

I thought it could only handle the testsuite-output? (not fpcunit)

Regards,

Joost.

Reply by email

Michael Van Canneyt
to Joost van der Sluis: I'm trying to run my fpcunit unit-tests on Gitlab, and let Gitlab show the results. But…
Joost van der Sluis wrote 8 lines
Hi all, 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.

Michael.

Reply by email

Joost van der Sluis
to Michael Van Canneyt

Op 29-12-2021 om 16:05 schreef Michael Van Canneyt via fpc-devel:

Show quoted text 11 lines
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.

Regards,

Joost.

Reply by email

Michael Van Canneyt
to Joost van der Sluis
Joost van der Sluis wrote 52 lines
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.

Reply by email