Recent

Poll

Do you use any unit testing framework?

Yes, FPCUnit with text output
0 (0%)
Yes, FPCUnit with XML output
2 (66.7%)
Yes, Dunit/Dunit2
1 (33.3%)
Yes, FPTest
0 (0%)
No
0 (0%)

Total Members Voted: 3

Voting closed: October 25, 2012, 05:45:59 am

Author Topic: FPCUnit users: improvements to XML output  (Read 3028 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
FPCUnit users: improvements to XML output
« on: October 16, 2012, 04:25:24 pm »
If you have requests to enhance/improve the XML output of FPCUnit, I'm currently thinking about adding some extra information:
- OS (win32,linux,solaris... taken from e.g. compiler)
- CPU (likewise taken from compiler)
- revision number/code version (handy for identifying regressions)
- some optional comment field for the test application to use

BTW, there apparently are 2 XML formats, the original one and one that gives Dunit/Junit like output - I'm talking about the latter. See e.g. the dbtestframework_gui.lpi database test, run it and click on Results XML.

I would like to get output something like this:

Edit: adapted layout a bit to follow DUnit2: http://members.optusnet.com.au/mcnabp/Projects/DUnit2/DUnit2Test.xml
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<TestResults>
  <!-- Generated using FPCUnit on 2012-10-16 16:18:46-->
  <TestListing>
    <TestProject Name="dbtestframework.exe/oracle">
    <RevisionID="22707"/> <!-- could be svn revision id, internal program version, git version, , even build dates in YYYYMMDDHHNNSS form etc, anything to identify regressions -->
    <OS="win32"/>
    <CPU="x86"/>
     <Comment="BigChimp: normally we'd expect testproject name to be the application name; however with dbtestframework, the database connector is a variable that determines what tests are run and therefore is important. I don't think it needs to be output as a separate variable. Do you?"/>
      <TestSuite Name="" ElapsedTime="00:00:00.732" NumberOfErrors="78" NumberOfFailures="0" NumberOfRunTests="80" NumberOfIgnoredTests="0">
        <TestSuite Name="TTestBasics" ElapsedTime="00:00:00.008" NumberOfErrors="0" NumberOfFailures="0" NumberOfRunTests="7" NumberOfIgnoredTests="0">
          <Test Name="TestParseSQL" Result="OK" ElapsedTime="00:00:00.002"/>
          <Test Name="TestInitFielddefsFromFields" Result="OK" ElapsedTime="00:00:00.001"/>
          <Test Name="TestDoubleFieldDef" Result="OK" ElapsedTime="00:00:00.000"/>
          <Test Name="TestFieldDefWithoutDS" Result="OK" ElapsedTime="00:00:00.000"/>
          <Test Name="TestGetParamList" Result="OK" ElapsedTime="00:00:00.001"/>
          <Test Name="TestGetFieldList" Result="OK" ElapsedTime="00:00:00.000"/>
          <Test Name="TestExtractFieldName" Result="OK" ElapsedTime="00:00:00.000"/>
        </TestSuite>
        <TestSuite Name="TTestFieldTypes" ElapsedTime="00:00:00.688" NumberOfErrors="73" NumberOfFailures="0" NumberOfRunTests="73" NumberOfIgnoredTests="0">
          <Test Name="TestEmptyUpdateQuery" Result="Error" ElapsedTime="00:00:00.022">
            <Message>TTestFieldTypes.TestEmptyUpdateQuery: Can not load SQLite client library "sqlite3.dll". Check your installation.</Message>
            <ExceptionClass>EInOutError</ExceptionClass>
            <ExceptionMessage>[SETUP] Can not load SQLite client library "sqlite3.dll". Check your installation.</ExceptionMessage>
            <SourceUnitName></SourceUnitName>
            <LineNumber>0</LineNumber>
            <FailedMethodName></FailedMethodName>
          </Test>
....
Code: [Select]
      </TestSuite>
     </TestProject>
  </TestListing>
  <NumberOfRunTests>80</NumberOfRunTests>
  <NumberOfErrors>78</NumberOfErrors>
  <NumberOfFailures>0</NumberOfFailures>
  <NumberOfIgnoredTests>0</NumberOfIgnoredTests>
  <TotalElapsedTime>00:00:00.737</TotalElapsedTime>
  <DateTimeRan>2012-10-16 16:18:47</DateTimeRan>
</TestResults>

Any more suggestions that could be useful when thinking about adding extra information?

Thanks,
BigChimp
« Last Edit: October 18, 2012, 05:42:38 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: FPCUnit users: improvements to XML output
« Reply #1 on: October 18, 2012, 05:55:05 am »
Perhaps adding a nice poll will get some interest going as well as some valuable information about what is actually used in the field...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018