Unit test troubles

Create issue
Issue #1 resolved
Former user created an issue

Dear developers,

I'm currently trying to build the sources from this library from scratch. Some unit tests failed because of some internal problems, others failed because of some real (windows) problems with the source code. The problems I have found are the following: - I'm using Windows, and

this.getClass().getResource("...").getFile()

will add a trailing / sign (e.g. "/D:/my/path/to/some.qcml") When this string is then used inside of the qcMl objects, and the tests will fail in some cases. I've had to perform a 'fix' using

new File(this.getClass().getResource("...").getFile()).getCanonicalPath()

to fix the paths in the relevant places, especially in QcDbReader to fix all filenames.

  • A second problem is the python script which apparently does not use some of the tags, so I unfortunately had to disable the testing of this script.

Comments (2)

  1. Wout Bittremieux

    Concerning the leading slash '/' when retrieving resources for running the unit tests, I could not find any particular unit test failures (tested on a native Mac OS X Mavericks and a virtual machine Microsoft Windows 7). However, some unit tests used an overly complicated approach to set the file name and compare this value between the XML files and the file name information in the qcDB, and this has been simplified (1f3b689). When reading a qcML XML file, only the name part of the path name is set as file name to ensure maximal portability, the path prefix is disregarded.

    Furthermore, the unit test using the Python script has been removed (08b643b), as this script was primarily an early proof of concept to convert between XML files and the qcDB, but never had full support. The conversion between an XML file and information in a qcDB (MySQL or SQLite) can also very easily be achieved using the different QcMLReader and QcMLWriter implementations.

    Finally, the unit tests requiring a connection to a MySQL qcDB are now run as integration tests through Maven, using an on-demand MySQL database (c1193b5). Therefore, they don't require a specific MySQL setup anymore to be run successfully.

  2. Wout Bittremieux

    An additional issue was found when loading the unit test resources from a path that contains a space. This is apparently a known Java bug and has now been fixed in the various unit tests (b443006).

  3. Log in to comment