Hello all, 

This week I’ve continued working on porting the Java code that creates the 
CRMDatabase. There were a few issues that made it a little more difficult than 
it seemed when first looking at the code. The first problem involved imports in 
the make files. When writing code to test out the ported functions, I didn’t 
include the correct imports in the makefiles, which manifested itself in run 
time errors that were non-obvious to me. After talking about it with Xisco over 
Gerrit code review, Xisco identified the problem, we introduced the correct 
imports and got everything working. 

The second issue that I ran into was the code that connects to the database 
using XConnection was interfering with the code that created the prepared 
queries using XDataSource. This was causing more run time errors that were not 
indicative of the root problem. After getting stuck on the issue, I lucked into 
the solution when running the code through the debugger, having to comment out 
the database connection in order to debug the relevant code. My take away from 
all this is to be more careful when testing pieces of code, and to try and test 
in isolation if possible and to always try the debugger first. 

The CRMDatabase patch has been merged here, so a test database can now be used 
in CppUnit tests! The test in CRMDatabase_test can be used as an example of how 
to get the necessary interfaces, and how to query from the database, etc.
https://gerrit.libreoffice.org/c/core/+/169573/8/dbaccess/qa/unit/CRMDatabase_test.cxx
 
<https://gerrit.libreoffice.org/c/core/+/169573/8/dbaccess/qa/unit/CRMDatabase_test.cxx>

The next steps are to use the new database in these tests that are waiting here
https://gerrit.libreoffice.org/c/core/+/169071 
<https://gerrit.libreoffice.org/c/core/+/169071>

After that, there are some more tests in dbaccess/complex that use the 
CRMDatabase that I will work on porting to CppUnit.

I have also spent some time on the Missing Unit test list. So far, I’ve not 
been able to get any of the bugs to reproduce when reverting to the pre bug fix 
commits. I will continue to try on new bugs, or with other techniques, in 
between writing other tests.

That’s if for this week,
Adam Seskunas

Reply via email to