https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19821
--- Comment #19 from Martin Renvoize <martin.renvo...@ptfs-europe.com> --- Created attachment 81894 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81894&action=edit Bug 19821: Run tests on a separate database Running the tests on the same database as the one used for dev has some drawbacks: - Everybody has different data, so we cannot make any assumptions about data in tests and it can make tests fail for non-obvious reasons. - Tests have to clean up every change to the database using SQL transactions, so we cannot write testable code that use transactions (AFAIK) - Transactions in tests happen to be committed sometimes, resulting in garbage data added to the dev database This patch provides a .proverc file that will load t/lib/Bootstrap.pm before the tests are run. t/lib/Bootstrap.pm is responsible for recreating a fresh database and telling the test scripts to use it. To use it, just run prove normally from the root directory of Koha. By default, the database is 'koha_test' and it's created using MARC21 SQL files, it can be changed by running: prove --norc \ --Mt::lib::Bootstrap=database,koha_test,marcflavour,UNIMARC Test plan: 1. mysql> GRANT ALL PRIVILEGES ON koha_test.* TO <your-db-user>@localhost 2. cd /path/to/koha 3. prove t/db_dependent/<pick-your-favorite-test-here>.t 4. Verify that it created the database koha_test and that the one you use usually was untouched (you can edit the test file and comment the lines related to a transaction (txn_begin, txn_rollback)) Signed-off-by: Jon Knight <j.p.kni...@lboro.ac.uk> Signed-off-by: Martin Renvoize <martin.renvo...@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/