[Koha-bugs] [Bug 19821] Run tests on a separate database
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Jun 15 14:39:34 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19821
Kyle M Hall <kyle at bywatersolutions.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #103409|0 |1
is obsolete| |
Attachment #103410|0 |1
is obsolete| |
Attachment #103411|0 |1
is obsolete| |
Attachment #103412|0 |1
is obsolete| |
Attachment #103413|0 |1
is obsolete| |
Attachment #103414|0 |1
is obsolete| |
Attachment #103415|0 |1
is obsolete| |
--- Comment #66 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 105876
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105876&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. Apply bug 19185 which will also apply these patches
2. In the DBMS run `select count(*) from koha_kohadev.borrowers;`
(adapt if your usual koha DB isn't koha_kohadev)
3. Run the test plan of bug 19185 and during execution of the
installation test, pay attention to the following:
4. List the databases in the DBMS (show databases;) to ensure that
koha_test is created
5. After the test has run, the koha_test database should not be here anymore.
6. In the DBMS run `select count(*) from koha_kohadev.borrowers;`
7. That was to verify that the database you use usually was untouched.
The counts should be the same.
Signed-off-by: Jon Knight <J.P.Knight at lboro.ac.uk>
Signed-off-by: Martin Renvoize <martin.renvoize at ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani at inlibro.com>
Signed-off-by: Victor Grousset/tuxayo <victor at tuxayo.net>
Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list