About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


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.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
unit_tests [2011/05/12 18:30] preetharaolegacy:vufind_1.x_developer_manual:unit_tests [2015/12/14 19:26] – ↷ Links adapted because of a move operation demiankatz
Line 1: Line 1:
 ====== Unit Tests ====== ====== Unit Tests ======
  
-//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.  If you are interested in testing performance rather than functionality, see the [[Testing Performance]] page instead.//+//This page refers to VuFind 1.x; for notes on VuFind 2.x unit tests, see [[development:testing:unit_tests|this page]].// 
 + 
 +//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.  If you are interested in testing performance rather than functionality, see the [[administration:testing_performance|Testing Performance]] page instead.//
  
 ===== Background ===== ===== Background =====
Line 117: Line 119:
  
 A base class has been created in tests/Selenium/lib/SeleniumTestCase.php which you can extend to create more tests.  The base class takes care of connecting to Selenium for you so you only have to worry about the actual testing.  You can look at existing Selenium tests to see how this works in action. A base class has been created in tests/Selenium/lib/SeleniumTestCase.php which you can extend to create more tests.  The base class takes care of connecting to Selenium for you so you only have to worry about the actual testing.  You can look at existing Selenium tests to see how this works in action.
 +
  
  
Line 128: 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.  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:
  
 == Step 1 == == Step 1 ==
Line 134: Line 137:
  
 == Step 2 == == Step 2 ==
-If the test needs a special MARC record to be reproduced, create one and preferably edit its prefix to "testbug#" where # will be your bug number.+If the test needs a special MARC record to be reproduced, create one and preferably edit its ID value (in the 001 field) to "testbug#" where # will be your bug number.
  
 == Step 3 == == Step 3 ==
Line 142: Line 145:
 </code> </code>
  
-**The name must start with word "Bug", # is the number to identify the bug **+**The directory name must start with word "Bug", # is the number to identify the bug **
  
-In you Bug# directory place your unit test filethe MARC record ( if any ) and AllTests.php file.+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# (where # matches the directory number).
  
 <code> <code>
 Example Example
 :~/vufind/tests/Selenium/Bugs/Bug1$ ll :~/vufind/tests/Selenium/Bugs/Bug1$ ll
--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*  --> Marc record to the particular Bug. -rwxr-xr-x 1  539 2011-05-10 12:34 heb.mrc*  --> Marc record to the particular Bug.
 </code> </code>
  
-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, SeleniumBugTest1b.php, etc.). The automated script will add all the tests and also import all the MARC files in a Bug directory.
- +
-**"AllTests.php" file at the Bug Directory level** +
- +
-You will need to mention the path of the Bug Directory, for example for Bug1 under the Bugs directory :- +
-<code> +
-$suite = new PHPUnit_Framework_TestSuite('VuFind - Selenium - Bugs - Bug1'); +
-</code> +
- +
- +
- +
  
 ---- struct data ---- ---- struct data ----
 ---- ----
  
legacy/vufind_1.x_developer_manual/unit_tests.txt · Last modified: 2018/12/19 13:56 by demiankatz