[Koha-devel] Unit tests and mock module

Robin Sheat robin at catalyst.net.nz
Fri Sep 7 14:51:03 CEST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Op 07-09-12 14:41, Paul Poulain schreef:
> * decide Mock is the way to go, and promote using of Mock,
> removing db_dependent tests (that fail if you don't have a
> database) * decide we should prefer db_dependent tests and limit
> the use of Mock to specific cases

The problem with many things in db_dependent is not that it requires a
database to run the tests, it's that the modules under test, or
required by the modules under test, load database information in their
BEGIN block.

These should be fixed where we can, as it's a) unnecessary db activity
if we never use that result, and b) I suspect will have issues with
persistence.

As for mocking a database, I think it's generally a good idea, unless
what you're actually testing is that something is talking to the
database itself correctly (there may even be ways around that too.)

- -- 
Robin Sheat
Catalyst IT Ltd.
? +64 4 803 2204
GPG: 5957 6D23 8B16 EFAB FEF8  7175 14D3 6485 A99C EB6D
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBJ7bUACgkQFNNkhamc623ZwgCeM8e3faOxxozD5ufttfYtHMqh
zIIAmgK38utk56aiZoQBIgOzBogFDggH
=+Pq5
-----END PGP SIGNATURE-----


More information about the Koha-devel mailing list