Skip to content

Latest commit

 

History

History
66 lines (41 loc) · 2.79 KB

RUNNING_TESTS.rdoc

File metadata and controls

66 lines (41 loc) · 2.79 KB

Creating test database

By default unit tests use MySQL database but PostgreSQL, Oracle and SQL Server databases are supported as well. Set MONDRIAN_DRIVER environment variable to “mysql” (default), “postgresql”, “oracle”, “luciddb”, “mssql” (jTDS) or “sqlserver” (Microsoft JDBC) to specify database driver that should be used.

If using MySQL, PostgreSQL or SQL Server database then create database user mondrian_test with password mondrian_test, create database mondrian_test and grant full access to this database for mondrian_test user. By default it is assumed that database is located on localhost (can be overridden with DATABASE_HOST environment variable).

If using Oracle database then create database user mondrian_test with password mondrian_test. By default it is assumed that database orcl is located on localhost (can be overridden with DATABASE_NAME and DATABASE_HOST environment variables).

If using LucidDB database then create schema MONDRIAN_TEST and create user MONDRIAN_TEST with password mondrian_test and with default schema MONDRIAN_TEST. By default it is assumed that database is located on localhost (can be overridden with DATABASE_HOST environment variable).

See spec/spec_helper.rb for details of default connection parameters and how to override them.

Creating test data

Install necessary gems with

bundle install

Create tables with test data using

rake db:create_data

or specify which database driver to use

rake db:create_data MONDRIAN_DRIVER=mysql
rake db:create_data MONDRIAN_DRIVER=postgresql
rake db:create_data MONDRIAN_DRIVER=oracle
rake db:create_data MONDRIAN_DRIVER=mssql
rake db:create_data MONDRIAN_DRIVER=sqlserver

In case of LucidDB data are not generated and inserted directly into database but are imported from MySQL mondrian_test database (because inserting individual records into LucidDB is very inefficient). Therefore at first generate test data with mysql (using default database settings) and then run data creation task for LucidDB.

rake db:create_data MONDRIAN_DRIVER=mysql
rake db:create_data MONDRIAN_DRIVER=luciddb

Running tests

Run tests with

rake spec

or specify which database driver to use

rake spec MONDRIAN_DRIVER=mysql
rake spec MONDRIAN_DRIVER=postgresql
rake spec MONDRIAN_DRIVER=oracle
rake spec MONDRIAN_DRIVER=luciddb
rake spec MONDRIAN_DRIVER=mssql
rake spec MONDRIAN_DRIVER=sqlserver

or also alternatively with

rake spec:mysql
rake spec:postgresql
rake spec:oracle
rake spec:luciddb
rake spec:mssql
rake spec:sqlserver

You can also run all tests on all databases with

rake spec:all

JRuby versions

It is recommended to use RVM (rvm.beginrescueend.com) to run tests with different JRuby implementations. mondrian-olap is being tested with latest versions of JRuby 1.6 and 1.7 on Java 6 and 7.