[fdo-dev] [UnitTest] More detailed log

Pierre Dalcourt pierre.dalcourt at autodesk.com
Mon Aug 28 10:24:41 EDT 2006


FYI: I will be dropping some changes this week to the cppunit code in
the SVN at fdocore.osgeo.org.  These changes which cause cppunit (when
running in text mode, as opposed to GUI mode) to output the name of each
unit test before it is run and the date/time it started running.  This
will help isolate crashes which prevent you from getting cppunit's
informative summary at the end.

Pierre

-----Original Message-----
From: Mateusz Loskot [mailto:mateusz at loskot.net] 
Sent: August 28, 2006 9:17 AM
To: dev at fdo.osgeo.org
Subject: Re: [fdo-dev] [UnitTest] More detailed log

Frank Warmerdam wrote:
> Mateusz Loskot wrote:
>>
>> I tried to run MySQL Unit Test for the first time and it failed
>> with exception thrown.
>> I expected it, but I wonder how could I get detailed log message
>> with file/line/function info?
>> Simply, how to know what to fix here?
>>
>> mloskot:~/dev/fdo/_svn/Providers/GenericRdbms/Src/UnitTest$
>> ./UnitTestMySql
>> Test ID: 2031106080
>> .F.F.F.F.F.F.F.F.F.F.F..F.F.F.Test is in group 'rollback', skipping
test
>> .Initializing Connection ...
>> terminate called after throwing an instance of 'FdoException*'
> 
> Mateusz,
> 
> My approach to this has been to go into the unit test mainline and
comment
> out all but one at a time, to isolate the issues.  If the unittest
runs
> to completion it provide detailed reports on the lines at which tests
> failed and then you can trace using that information to find out
> what is going wrong.

Frank,

Thank you for this hint. I'll use it too.

> I do wonder if there is an easier way.

I'm not sure, because I've never used CppUnit, but I'd expect
it to support detailed error reports.

I'd like to give some live example, to show what I mean as a minimal
good error report of test case failure.
This is a piece of report generated by GEOS Unit Tests:
In following report, the longer name on the left is a test suite name
(tests group name), dot represents single test case pass,
if test case in particular suite fails,
then it's presented as [NUM=F] instead of dot, where NU is a
number of test case, F is a flag of test failure type.

...
geos::geom::MultiPolygon: . 1
geos::geom::Point: ........................[25=F].............. 38
geos::geom::Polygon: ..................................... 37
geos::util::UniqueCoordinateArrayFilter: . 1

---> group: geos::geom::Point, test: test<25>
     problem: assertion failed
     failed assertion: "expected Point actual LineString"

Tests summary:
 - failures:1
 - passed: 336

Tests summary says that one test case failed, also geos::geom::Point
test suite execution path includes [25=F] - test case with number 25
failed with F flag what means, that some unit test assertion did not
passed.

Just above the test summary is more complete error report that includes:
full name of test suite (group), test number - 25 and descriptive
assertion message.


Now, I'm able to find what's going wrong, get back to the test
case No. 25 and examine why the assertion does not pass.

Are there similar reporting features supported in the FDO Unit Tests?
Could you explain your best practice during the dev cycle:
fix -> run unit tests -> check what failed -> fix

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at fdo.osgeo.org
For additional commands, e-mail: dev-help at fdo.osgeo.org





More information about the Fdo-internals mailing list