ownCloud uses automated testing to check for problems, and writing and executing these tests is important for any contributor. In my capacity as an ownCloud systems developer I use these tests to quickly verify that my apps don’t break after merging or pulling new code. For those less familiar with Ruby however, getting the Cucumber based behaviour tests running can be confusing. Here’s how to do it on Fedora.
- Install the necessary dependencies:
sudo yum install libxslt libxslt-devel libyaml libyaml-devel xorg-x11-server-Xvfb openssl-devel
- Install RVM. If you have previously installed it, you may need to reinstall it so that the newly available libraries are used:
sudo rvm install 1.9.3
- Install the Selenium gem:
sudo gem install selenium-webdriver
- Clone the acceptance-testing repository from GitHub:
git clone https://github.com/owncloud/acceptance-testing
- Switch to root (
su
), and enter the newly created directory (this will trigger the .rvmrc shell script):
cd acceptance-testing
- Accept the warning and agree to run the script
- If the script encounters errors (e.g. “RVM not found” or “RVM is not a function”), then open a new terminal, and repeat steps from “Switch to root”.
- If you are testing a copy of ownCloud running locally on your machine, start your webserver, e.g.:
service httpd start
- Run cucumber to execute the tests:
cucumber HOST=foo.bar.com features
To install on a *ubuntu 12.10 system that would be:
sudo apt-get install libxslt1.1 libxslt-dev xvfb build-essential git-core curl
The ruby-rvm package apparently doesn’t exists on 12.10, and the ruby version from the repository doesn’t match the downloaded rvm, so from I installed in my home dir:
curl -L https://get.rvm.io | bash -s stable –ruby
echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm”‘ >> ~/.bashrc
echo ‘export PATH=$HOME/.rvm/bin:$PATH’ >> ~/.bashrc
. .bashrc
gem install selenium-webdriver
I forgot to add:
bundle install
Thanks Thomas!