dev:contributing:qa
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dev:contributing:qa [2015/01/23 11:58] – created erickson | dev:contributing:qa [2024/09/13 13:24] (current) – [C Unit Tests] add a tag sandbergja | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== QA Requirements for Evergreen Code Contributions ==== | + | ====== QA Requirements for Evergreen Code Contributions |
- | === Types of Tests === | + | ===== Minimum Requirements ===== |
- | == Perl Unit Tests == | + | As of Evergreen version 2.8, new code contributions must be submitted with test code. |
- | Perl unit tests exercise Perl functions which can be executed without a running | + | ==== Evergreen |
- | Files are kept in the Evergreen repository under Open-ILS/ | + | 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. |
+ | |||
+ | ==== Evergreen 2.9 ==== | ||
+ | |||
+ | As of Evergreen 2.9, the test case expectations include: | ||
+ | |||
+ | * Any time a patch adds or alters a stored procedure, pgTAP tests that exercise its intended functionality should be included. | ||
+ | * A change to database or Perl code that fixes a bug should be accompanied by a Perl (t or live_t) or pgTAP regression test – or by a statement from the patch author explaining why a test is infeasible without significant refactoring. | ||
+ | * Bugfix patch commit messages should explain how to test the bug it fixes. For example: rather than just write a bare " | ||
+ | |||
+ | LP#124565: fix Evergreen' | ||
+ | |||
+ | Evergreen does not do an adequate job of petting cats. To | ||
+ | reproduce the problem: | ||
+ | |||
+ | [1] Bring up an Evergreen OPAC and place a cat | ||
+ | in front of it. | ||
+ | [2] Observe that a hand appears and makes waving | ||
+ | motions a centimeter over the cat. | ||
+ | [3] Observe that the cat does not purr. | ||
+ | [4] Apply the patch. | ||
+ | [5] This time, verify that the hand actually makes contact | ||
+ | with the cat. | ||
+ | [6] Expected result: the cat purrs. | ||
+ | |||
+ | |||
+ | |||
+ | ===== Types of Tests ===== | ||
+ | |||
+ | ==== AngularJS Unit Tests ==== | ||
+ | |||
+ | These test the Web Client apps. | ||
+ | |||
+ | * They are stored in '' | ||
+ | * See the [[https:// | ||
+ | |||
+ | Running the tests: | ||
+ | * See the [[https:// | ||
+ | * Steps to run the tests as of Evergreen 3.1: | ||
+ | |||
+ | cd $EVERGREEN_ROOT/ | ||
+ | # fetch JS dependencies, | ||
+ | npm install | ||
+ | # build, run tests, concat+minify | ||
+ | npm run build-prod | ||
+ | npm run test | ||
+ | |||
+ | ==== Angular Unit Tests ==== | ||
+ | |||
+ | See [[dev: | ||
+ | |||
+ | To run on a running Evergreen server: | ||
+ | |||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | npm run test | ||
+ | </ | ||
+ | |||
+ | ==== Angular e2e (end-to-end) Tests ==== | ||
+ | |||
+ | To run with a GUI: | ||
+ | |||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | ng e2e | ||
+ | </ | ||
+ | |||
+ | To run without a GUI: | ||
+ | |||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | MOZ_HEADLESS=1 ng e2e | ||
+ | </ | ||
+ | |||
+ | To run in Chrome instead of Firefox: | ||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | npm install --save-dev chromedriver | ||
+ | ng e2e --env chrome # with the GUI | ||
+ | ng e2e --env chrome-headless # without the GUI | ||
+ | </ | ||
+ | |||
+ | For more tips and documentation, | ||
+ | |||
+ | ==== OPAC Javascript Unit Tests ==== | ||
+ | |||
+ | To run tests for the javascript in the OPAC: | ||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | npm i && npm run test | ||
+ | </ | ||
+ | |||
+ | ==== 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:// | ||
+ | * Files are kept in the Evergreen repository under Open-ILS/ | ||
+ | * Tests are run with "make check" in the root of the repository after " | ||
For a simple example, see Open-ILS/ | For a simple example, see Open-ILS/ | ||
Line 20: | Line 118: | ||
+ | ==== Perl Live Tests ==== | ||
+ | |||
+ | Live tests are used for testing a running Evergreen system. | ||
+ | |||
+ | NOTE: The " | ||
+ | |||
+ | * Tests are built using Perl's http:// | ||
+ | * Files are kept in the Evergreen repository under Open-ILS/ | ||
+ | |||
+ | Running the live tests: | ||
+ | |||
+ | <code sh> | ||
+ | # assumes ./configure and make have already been run | ||
+ | cd Open-ILS/ | ||
+ | make livecheck | ||
+ | </ | ||
+ | |||
+ | For a simple example, see Open-ILS/ | ||
+ | |||
+ | <code perl> | ||
+ | my $ses = $script-> | ||
+ | my $req = $ses-> | ||
+ | if (my $resp = $req-> | ||
+ | if (my $user = $resp-> | ||
+ | is( | ||
+ | ref $user, | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ==== pgTAP Database Tests ==== | ||
+ | |||
+ | pgTAP is used to test database behavior. | ||
+ | |||
+ | * Tests are built using http:// | ||
+ | * Files are kept in the Evergreen repository under Open-ILS/ | ||
+ | |||
+ | The " | ||
+ | |||
+ | Install pgtap from source, the versions in Debian/ | ||
+ | |||
+ | * Download from - http:// | ||
+ | * Install Instructions - http:// | ||
+ | * Install the package for libtap-parser-sourcehandler-pgtap-perl which provides pg_prove. | ||
+ | |||
+ | <code sh> | ||
+ | apt-get install libtap-parser-sourcehandler-pgtap-perl # | ||
+ | psql -U evergreen [other DB connection params] -c " | ||
+ | </ | ||
+ | |||
+ | To run pgTAP tests: | ||
+ | |||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | 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 " | ||
+ | |||
+ | * Files are kept in the Evergreen repository under Open-ILS/ | ||
+ | |||
+ | Running live tests: | ||
+ | |||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | pg_prove -U evergreen [other DB connection params] live_t | ||
+ | </ | ||
+ | |||
+ | ==== 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:// | ||
+ | * Files live in Open-ILS/ | ||
+ | * Tests are automatically executed when running "make check" | ||
+ | At time of writing, there is no equivalent to " | ||
+ | {{tag> |
dev/contributing/qa.1422032333.txt.gz · Last modified: 2022/02/10 13:34 (external edit)