User Tools

Site Tools


dev:contributing:qa

This is an old revision of the document!


QA Requirements for Evergreen Code Contributions

Minimum Requirements

As of Evergreen version 2.8, new code contributions must be submitted with test code.

Evergreen 2.8

One of the main goals for the 2.8 series regarding QA tests is encouraging developers to engage in the process and learn how to build tests. The only requirement is that any commits which modify code that has a functional test structure in place (e.g. database changes – see "Types of Tests" below) must be accompanied by at least one test that in some way exercises the change. It does not have to test every facet of the new code. We're aiming for one step beyond "Hello, World".

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/.
  • Tests are automatically executed when running "make check"

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.

Running the live tests:

# assumes ./configure and make have already been run
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

pgTAP Live 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/

Running live tests:

cd Open-ILS/src/sql/Pg
pg_prove -U evergreen [other DB connection params] t_live

C Unit Tests

Like Perl unit tests, C unit tests are used for testing code that does not require a running Evergreen system.

 
* They are built using http://check.sourceforge.net/
* Files live in Open-ILS/src/c-apps/tests
* Tests are automatically executed when running "make check"

At time of writing, there is no equivalent to "live" tests for C code.

dev/contributing/qa.1422548961.txt.gz · Last modified: 2022/02/10 13:34 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.