[fdo-dev] [UnitTest] More detailed log

Mateusz Loskot mateusz at loskot.net
Mon Aug 28 09:16:33 EDT 2006


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




More information about the Fdo-internals mailing list