InterMine Tests
#
Continuous IntegrationWe run all our tests on every commit using the Continuous Integration service Travis. You can do the same for your fork:
- Log in to Travis-CI with your GitHub account.
- Enable your fork of intermine for Travis builds.
All the tests will be run on every change you make, and you will be notified of errors by email.
#
Setting up a Local Test EnvironmentAfter getting the source code for InterMine and ensuring you have all of the required prerequisites, the next step is to try the tests to confirm that everything runs well in your environment.
We also recommend looking at the files that run our continuous integration tests for examples of how this can be automated:
config/travis/init.sh
config/travis/run.sh
#
Running the core tests#
Create databasesCreate blank databases required by the tests named: unittest
, truncunittest
, fulldatatest
, flatmodetest
, notxmltest
. See PostgresBasics and introduction to some Postgres commands.
#
Update properties fileYou need to set up a properties file to provide database details to the test code. In your home directory create a file called intermine-test.properties
and update the server name, database names, and database username and password. You can use different database names as long as the actual database name used to create the database and the db.xxx.datasource.databaseName
value match.
#
Run the tests#
View resultsThe HTML test report will be created in the build directory, eg. intermine/objectstore/test/build/test/results/index.html
Pull requests are not accepted without passing tests, and we have Travis set up to run tests on every commit. We keep the tests at a 100% pass rate at all times.
#
Running the bio testsInterMine includes a bio
project which contains specific code for biological data and parsers for many data formats. To run tests on this code you need to set up another properties file and create some more databases.
#
Create databasesCreate blank databases called bio-test
and bio-fulldata-test
(as above you can use different names as long as they match the db.xxx.datasource.databaseName
values. For example:
#
Update properties fileSet up a properties file to provide database details to the test code. In .intermine
create a file called intermine-bio-test.properties
and configure the server name, database names, and database username and password.
#
Build the databasesBuild database tables automatically generated from the bio model by running the following in bio
:
#
Run the testsExecute the tests, in bio
run:
#
Run a single testYou can also run a test for an individual source by using this syntax:
The test results will be located at bio/model/test/build/test/results/index.html
. You can also run these as JUnit tests directly from Eclipse or Intellij.