-
Notifications
You must be signed in to change notification settings - Fork 64
SauceLabs Tests
During the next months (starting after the P2PU workshop in Nov 2011) we will be including tests on lernanta to be run in SauceLabs. These tests will allow us to check how things work (at the moment this does not include how things look) in different browsers. This wiki page will document how to get started using/writing these tests.
The free account on Sauce Labs will give you 200 OnDemand min/month that you can use to run these tests. Each developer can create one of these free accounts.
At the moment we have our first tests on PhP and when you create your account you will be able to see instructions for installing dependencies and running a basic OnDemand PhP test. This instructions should be somehow equivalent to running the following commands:
sudo apt-get install libtool autoconf automake uuid-dev make g++
sudo apt-get install php5-curl
sudo apt-get install php5-xdebug
sudo apt-get install php5-memcache
sudo apt-get install php-pear
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
sudo pear install pear.phpunit.de/PHPUnit
sudo apt-get install memcached
sudo apt-get install curl
sudo apt-get install php5-mcrypt
sudo apt-get install phpunit
sudo pear upgrade
sudo pear channel-update pear.php.net
sudo pear upgrade pear
sudo pear channel-discover pear.phpunit.de
sudo pear channel-update pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-update components.ez.no
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-update pear.symfony-project.com
sudo pear channel-discover saucelabs.github.com/pear
sudo pear channel-update saucelabs.github.com/pear
sudo pear install -a saucelabs/PHPUnit_Selenium_SauceOnDemand
You will need to install ant which is used to run our tests
sudo apt-get install ant1.7
A few environment variables need to be configured to run the tests. You can add the following lines to the ~/.bashrc file in your home directory, so you don't need to run the following lines each time you open a new shell. Note that you need to replace there your SauceLabs username and key (the key can be found at Account>My Account>View my api key)
# Sauce
export SAUCE_USER_NAME=your_saucelabs_username
export SAUCE_ACCESS_KEY=your_saucelabs_key
Inside the lernanta/lernanta directory you can run the tests by executing
ant
See their progress at OnDemand Jobs page. By default the tests will be run against alpha.p2pu.org as specified in P2PUSauceBase.php.
To run the tests against your local environment you need to first use the following command to start the django server:
python manage.py runserver 0.0.0.0:8000
Add a domain pointing to 127.0.0.1 in your /etc/hosts file. The line will look like:
127.0.1.1 lernantatest.myfakedomain.com
Setup an environment variable (manually or at ~/.brashrc) so that the tests are not run againts alpha.p2pu.org but against lernantatest.myfakedomain.com:8000 (or the domain you wrote at /etc/hosts)
export SAUCE_BROWSER_BASE_URL=lernantatest.myfakedomain.com:8000
Run Sauce Connect which you can download from https://saucelabs.com/docs/ondemand/connect (remember to make it executable with 'chmod +x Sauce-Connect.jar')
./Sauce-Connect.jar $SAUCE_USER_NAME $SAUCE_ACCESS_KEY
Then run ant as you did before and check the job status on SauceLabs
ant