Skip to content
Snippets Groups Projects
user avatar
Monika Komorowska authored
e1794a0c
    This directory contains a set of  tests for the Ensembl API modules.
    The test_genome.zip  file contains the set  of data that is  used by
    the tests.

    The test  system requires some modules  which are in a  seperate CVS
    module ensembl-test.  To use the tests you must add the ensembl-test
    modules to your PERL5LIB environment variable.

    Example (for tcsh or csh):

      setenv PERL5LIB ${PERL5LIB}:${ENSHOME}/ensembl-test/modules

    Example (for ksh or bash):

      export PERL5LIB=${PERL5LIB}:${ENSHOME}/ensembl-test/modules

    This  is assuming  ENSHOME  is  the directory  into  which you  have
    checked out your CVS source trees.

    In  order to  run the  tests  you must  create a  t/MultiTestDB.conf
    file  with connection  details (username,  host, etc.)  for a  MySQL
    instance where  you have  write permission.   An example  file named
    MultiTestDB.conf.example is  included in the /t  directory.  Running
    test case(s) which require a  database will automatically create and
    remove a temporary database during the test(s) execution.

    To run  multiple tests at once  use the runtests.pl script  which is
    found in  the ensembl-test/scripts directory.   It may be  useful to
    add  this directory  to  your path.   To run  a  single test  simply
    execute the *.t file:

    Examples:

      # run all tests in the t directory
      runtests.pl t

      # run 3 tests
      runtests.pl t/gene.t t/exon.t t/densityFeature.t

      # run a single test
      perl t/gene.t

    If you need  to modify the schema  of the database and  dump the new
    table structure and  data before commiting to CVS,  the quickest way
    to do it is:

    Example: we want to dump the external_db table

      # to dump the table structure, without headers or any
      # additional MySQL specific information
      mysqldump -d --compact \
        -h ens-research -u ensro \
        my_database external_db > external_db.sql

      # to dump the data in a tab delimited file format and
      # replacing "NULL" with "\N".
      mysql -BN \
        -e 'select * from external_db' \
        -h ens-research -u ensro \
        my_database | sed 's/NULL/\\N/g' > external_db.txt

    The  two  files  that  are   created,  (in  the  above  example  are
    external_db.sql and external_db.txt) are the  ones that will have to
    be committed to CVS under

      ensembl/modules/t/test-genome-DBs/homo_sapiens/core/

    This way to  dump data is only suitable for  small tables, (like the
    ones in the  unit tests).  For bigger tables, you  might need to use
    the standard mysqldump.