openSUSE:Build Service Testsuite

Jump to: navigation, search

OBS Testsuites

OBS api test suite

The api test suite is testing code of the ruby on rails stack powering the api, including parts of the backend. This is currently only the source server, but it can be extended to cover more parts.

Install api testsuite

First of all you need all needed package dependencies. The easiest is to add the matching repository from the "openSUSE:Tools" project and install the obs-api and obs-server package.

Afterwards you can clone the git repository:

git clone git://gitorious.org/opensuse/build-service.git
cd build-service
git submodule update --init

You need to have a running mysql database with the OBS api database. Read the "dist/README.SETUP" file for instructions to do so.

You need to create and configure also a "test" datbase for example via calling

     # mysql -u root -p
     mysql> create database api_test;
     mysql> GRANT all privileges ON api_production.* TO 'obs'@'%', 'obs'@'localhost';
     mysql> FLUSH PRIVILEGES;
     mysql> quit

and then

 # cd src/api
 # cp config/database.yml.example config/database.yml

and edit the config/database.yml file's test section to contain username: obs

Run the testsuite

Running the testsuite is easy, just go to the right directory and call:

# cd src/api
# rake test

Run a single test

For running a single test, you can run

# ruby test/functional/source_controller_test.rb

for example.

Write a test

Add fixtures data

Your test may relay on existing data. To have fixed data, you need to add a fixture. Please check any test/fixtures/$DATABASE_TABLE.yml file. You can extend existing ones or add new files in this directory.

Add a functional test

Existing functional tests can be found in the "test/functional/" directory.

OBS webui test suite