This is an old revision of the document!
Table of Contents
QA Requirements for Evergreen Code Contributions
Types of Tests
Perl Unit Tests
These are used for testing Perl functions which can be executed without a running Evergreen system.
- They are built using Perl's http://perldoc.perl.org/Test/More.html
- Files are kept in the Evergreen repository under Open-ILS/src/perlmods/t/.
- Unit tests are executed during the "make check" phase when building Evergreen
For a simple example, see Open-ILS/src/perlmods/t/01-OpenILS-Application.t. Of note is the following section of code which tests a Perl function in the AppUtils.pm module:
is( OpenILS::Application::AppUtils::entityize(0, 'èöçÇÈÀ'), 'èöçÇÈÀ', 'entityize: diacritics' );
Perl Live Tests
Live tests are used for testing a running Evergreen system. They can communicate over the network, talk to the database, etc. To execute live tests, Evergreen must be running and the "concerto" data set must be installed.
NOTE: The "concerto" dataset can be installed when the database is built using the "–load-all-sample" option.
- Tests are built using Perl's http://perldoc.perl.org/Test/More.html
- Files are kept in the Evergreen repository under Open-ILS/src/perlmods/live_t/.
Running the live tests:
cd Open-ILS/src/perlmods make livecheck
For a simple example, see Open-ILS/src/perlmods/live_t/00-simple.t. Note how it's making API calls to the open-ils.storage service.
my $ses = $script->session('open-ils.storage'); my $req = $ses->request('open-ils.storage.direct.actor.user.retrieve', 1); if (my $resp = $req->recv) { if (my $user = $resp->content) { is( ref $user, 'Fieldmapper::actor::user', 'open-ils.storage.direct.actor.user.retrieve returned aou object' ); ...
pgTAP Database Tests
pgTAP is used to test database behavior. These tests require access to an Evergreen database, but do not require a running Evergreen server or the concerto data set.
- Tests are built using http://pgtap.org/
- Files are kept in the Evergreen repository under Open-ILS/src/sql/Pg/t/
The "pgtap" package, which is not part of a standard Evergreen installation, must be installed and the extension must be added to your Evergreen database:
sudo apt-get install pgtap # debian/ubuntu version psql -U evergreen [other DB connection params] -c "CREATE EXTENSION pgtap;"
To run pgTAP tests:
cd Open-ILS/src/sql/Pg pg_prove -U evergreen [other DB connection params] t t/regress live_t
Live pgTAP Database Tests
Live pgTAP tests are built in the same manner as regular pgTAP tests, with the added requirement / assumption that the concerto data set is installed.
NOTE: The "concerto" dataset can be installed when the database is built using the "–load-all-sample" option.
- Files are kept in the Evergreen repository under Open-ILS/src/sql/Pg/live_t/