Warning: This page has not been updated in over over a year and may be outdated or deprecated.
legacy:vufind_1.x_developer_manual:unit_tests
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
unit_tests [2011/05/12 18:29] – preetharao | unit_tests [2012/09/21 15:48] – demiankatz | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Unit Tests ====== | ====== Unit Tests ====== | ||
+ | |||
+ | //This page refers to VuFind 1.x; for notes on VuFind 2.x unit tests, see [[vufind2: | ||
//This page is aimed at developers who want to test that their changes have not broken existing VuFind functionality or who are interested in creating standard tests for new VuFind components. | //This page is aimed at developers who want to test that their changes have not broken existing VuFind functionality or who are interested in creating standard tests for new VuFind components. | ||
Line 117: | Line 119: | ||
A base class has been created in tests/ | A base class has been created in tests/ | ||
+ | |||
+ | |||
Line 127: | Line 131: | ||
==== Testing Bugs ==== | ==== Testing Bugs ==== | ||
- | Bugs can be tested as part of continuous integration process.This will ensure that any new code didn't reverse the fix for a bug.The steps to add tests for Bugs is as follows:- | + | Bugs can be tested as part of continuous integration process. |
== Step 1 == | == Step 1 == | ||
Line 133: | Line 137: | ||
== Step 2 == | == Step 2 == | ||
- | If the test needs a special MARC record to be reproduced, create one and preferably edit its prefix | + | If the test needs a special MARC record to be reproduced, create one and preferably edit its ID value (in the 001 field) |
== Step 3 == | == Step 3 == | ||
- | Create a Directory with name " | + | Create a Directory with name " |
< | < | ||
/ | / | ||
</ | </ | ||
- | In you Bug# directory place your unit test file, the MARC record ( if any ) and AllTests.php file. | + | |
+ | **The directory name must start with word " | ||
+ | |||
+ | In you Bug# directory place your unit test file and the MARC record (if any). It is recommended that you name your test class SeleniumBugTest# | ||
< | < | ||
Example | Example | ||
: | : | ||
- | -rwxr-xr-x 1 2360 2011-05-10 13:27 AllTests.php* --> File to include the bug as part of testing. | + | -rwxr-xr-x 1 2096 2011-05-03 13:33 SeleniumBugTest1.php* --> Unit test for the Bug. |
- | -rwxr-xr-x 1 2096 2011-05-03 13:33 Bug_test_heb.php* --> Unit test for the Bug. | + | |
-rwxr-xr-x 1 539 2011-05-10 12:34 heb.mrc* | -rwxr-xr-x 1 539 2011-05-10 12:34 heb.mrc* | ||
</ | </ | ||
- | You may have more than one Unit tests for a particular Bug or more than one MARC record too.The automated script will add all the tests and also import all the MARC files in a Bug directory. | + | If necessary, you may have more than one Unit test for a particular Bug or more than one MARC record too (i.e. SeleniumBugTest1a.php, |
- | + | ||
- | **" | + | |
- | + | ||
- | You will need to mention the path of the Bug Directory, for example for Bug1 under the Bugs directory :- | + | |
- | < | + | |
- | $suite = new PHPUnit_Framework_TestSuite(' | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | + | ||
---- struct data ---- | ---- struct data ---- | ||
---- | ---- | ||
legacy/vufind_1.x_developer_manual/unit_tests.txt · Last modified: 2018/12/19 13:56 by demiankatz