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' ); ...