dev:contributing:qa
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| dev:contributing:qa [2015/01/29 11:29] – [Perl Live Tests] erickson | dev:contributing:qa [2025/09/09 14:55] (current) – lint section sleary | ||
|---|---|---|---|
| Line 8: | Line 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. | 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 ===== | ===== 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 Lint ==== | ||
| + | |||
| + | See '' | ||
| + | |||
| + | To run on a running Evergreen server: | ||
| + | |||
| + | <code sh> | ||
| + | cd Open-ILS/ | ||
| + | ng lint | ||
| + | </ | ||
| + | |||
| + | To fix syntax errors automatically: | ||
| + | |||
| + | <code sh> | ||
| + | cd Open-ILS/ | ||
| + | ng lint --fix | ||
| + | </ | ||
| + | |||
| + | We also have several [[https:// | ||
| + | |||
| + | You can check out [[https:// | ||
| + | |||
| + | ==== Angular Unit Tests ==== | ||
| + | |||
| + | See [[dev: | ||
| + | |||
| + | To run on a running Evergreen server: | ||
| + | |||
| + | <code sh> | ||
| + | cd Open-ILS/ | ||
| + | npm run test | ||
| + | </ | ||
| + | |||
| + | === Common things that break Angular unit tests === | ||
| + | |||
| + | == Changing DOM selectors == | ||
| + | |||
| + | If the test is expecting a certain DOM element, but you change the structure within an Angular template, the test might start failing. | ||
| + | |||
| + | Note that you can use text of a button as a selector. | ||
| + | |||
| + | To fix it: update the selector in the test. Or perhaps the test can be made more general. | ||
| + | |||
| + | == Adding a new service == | ||
| + | |||
| + | Adding a new service | ||
| + | |||
| + | To fix it: add a mock for the new service in the test. Or even better, consider if you can simplify or refactor the component so that it does not need many different services. | ||
| + | |||
| + | == Lifecycle/ | ||
| + | |||
| + | Interacting with anything asynchronous (especially grid and combobox) requires some care! | ||
| + | |||
| + | To fix it: You may be able to add a setTimeout. | ||
| + | |||
| + | ==== 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 ==== | ==== Perl Unit Tests ==== | ||
| Line 17: | Line 149: | ||
| * They are built using Perl's http:// | * They are built using Perl's http:// | ||
| * Files are kept in the Evergreen repository under Open-ILS/ | * Files are kept in the Evergreen repository under Open-ILS/ | ||
| - | * Tests are automatically executed when running | + | * Tests are run with "make check" |
| For a simple example, see Open-ILS/ | For a simple example, see Open-ILS/ | ||
| Line 70: | Line 202: | ||
| The " | 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> | <code sh> | ||
| - | sudo apt-get install pgtap # debian/ubuntu version | + | apt-get install |
| psql -U evergreen [other DB connection params] -c " | psql -U evergreen [other DB connection params] -c " | ||
| </ | </ | ||
| Line 95: | Line 233: | ||
| <code sh> | <code sh> | ||
| cd Open-ILS/ | cd Open-ILS/ | ||
| - | pg_prove -U evergreen [other DB connection params] | + | pg_prove -U evergreen [other DB connection params] |
| </ | </ | ||
| Line 107: | Line 245: | ||
| At time of writing, there is no equivalent to " | At time of writing, there is no equivalent to " | ||
| + | |||
| + | {{tag> | ||
dev/contributing/qa.1422548961.txt.gz · Last modified: 2022/02/10 13:34 (external edit)