Automated Test Setup Instructions
From Sfiabwiki
SFIAB Automated Test setup Guide
1) What is the test suite?
The purpose of this guide is walk you through setting up the SFIAB Automated Test Suite. Automated tests are a way to ensure that your SFIAB installation is still working as expected when modifications have been made to the SFIAB code, or when a new version of SFIAB comes out.
2) What is Selenium?
Selenium is an open-source test tool that can be used to perform tests in a web browser. Selenium is used to execute the tests. It does this by executing scripted commands in the browser. For example, to login, the test script will say (at a high level) something like : - go to the login url - type the user's name in the username text box - type the user's password in the password text box - click the login button - verify that the login worked
3) How do I setup the tests?
It is *highly* recommended that you not run the automated tests against your actual SFIAB installation as the tests will be creating and deleting data. At a high level, the process to setup the tests is (these points will be more thoroughly explained below) : 1) Install a testing SFIAB installation. This should be completely separate from your 'real' SFIAB url and must use a separate database. 2) Record the superuser account information to be used by the automated tests. 3) Create a regular user account and perform a few actions on the installation to make sure that the installation was successful. 4) Install Selenium on the same server as your test installation and run the Selenium tests. 5) Get the latest SFIAB tests, upload them to the server, and edit the configuration file appropriately. 6) Run the tests.
1) Install a testing SFIAB Installation. Follow the installation guide [1] as you normally would for an SFIAB installation. Remember to use a different database from your actual SFIAB installation.
2) Record the superuser account information to be used by the automated tests. The automated tests need to login as the superuser, so you will need this information when you edit the test configuration file (step 5).
3) Create a regular user account and perform a few actions. In order to make sure that the tests are run against a proper and working installation, make a test judge and participant and verify that you can perform a few actions. The purpose of this exercise it just to verify the installation.
4) Install Selenium on the same server as your test installation and run the Selenium tests.
1) Download Selenium 0.6 from [2]. 2) Extract the files on your harddrive and then upload the 'selenium' directory to the same webserver as your SFIAB installation. 3) Once the upload is done, point a web browser to the 'selenium' folder and click the 'Main TestSuite link. 4) Click the 'All' button while the 'Run' radio button is selected. Your browser will execute a number of actions. This is Selenium testing itself. Wait until this finshes. In the top-left panel, every test should be green. (You may see two tests fail if you are using a popup-blocker. This is normal until you add the test URL to the 'allowed' list.) When the tests run successfully, Selenium will be installed.
The automated tests also require a Selenium extension named 'updateFeedback'.
1) Download the updateFeedback extension from [3]. 2) Extract the files from the archive and upload the 'selenium' folder to the webserver. 3) Delete the 'TestRunner.html' file and rename the 'TestRunner-updateFeedback.html' to 'TestRunner.html' 4) Rename 'user-extensions.js.updateFeedback to 'user-extensions.js' 5) Run the 'updateFeedback' tests by navigating to '<selenium>/TestRunner.html?test=tests/TestSuite-updateFeedbackCommand.html' and clicking the 'All' button. When both tests finish 'green', you know the extension is working.
5) Get the latest SFIAB tests, upload them to the server, and edit the configuration file appropriately. To download the SFIAB tests, you will need a subversion client. For windows, use Tortoise SVN [4].
1) Download the tests from the repository at [5] 2) Edit the sfiab/Global_Variables.inc file. change the PATH_AUT variable to point to your SFIAB installation folder. change the SF_NAME variable to match the name of your Sciene Fair.
For example,
<tr> <td>store</td> <!-- Change the value below to the root SFIAB folder --> <td>projects/sfiab/sfiab_app</td> <td>PATH_AUT</td> </tr>
would become
<tr> <td>store</td> <!-- Change the value below to the root SFIAB folder --> <td>sfiab</td> <td>PATH_AUT</td> </tr>
for most installations.
You will have to update each variable defined in Global_Variables.inc to work for your installation.
3) Add the following url to your <selenium>/index.html page : <a href="<selenium>/TestRunner.html?test=tests/TestSuite-SFIAB.html">TestSuite-SFIAB</a> 4) Upload the entire directory to the <selenium>/tests folder. (This will create a directory under <selenium>/tests named 'sfiab'). 5) Point a browser to <selenium>/ and click on the TestSuite-SFIAB link. 6) Click 'All' to run your tests.
Following the steps detailed above will allow you to run the SFIAB automated test suite on your own installation.