Skip to content
Lukas Mueller edited this page Mar 10, 2022 · 6 revisions

Running Breedbase testing suite

Using Docker

Running tests manually

The t/unit, t/unit_fixture, and t/unit_mech tests can be run directly from inside the breedbase_web docker, using the t/test_fixture.pl script, for example:

perl t/test_fixture.pl t/unit_fixture

will run all the fixture tests.

To run selenium tests in the docker, you can use the docker-compose.test.yml file and instantiate that system. It will run all the appropriate tests and the selenium tests, based on the selenium docker. You can also include the selenium docker in any other appropriate docker-compose.yml file, for example, your development setup, which allows you to run the selenium tests interactively during development. The breedbase_web docker needs the following environment variables set for the selenium docker to work:

   #assuming web docker is called breedbase_web and selenium docker selenium:
   SGN_TEST_SERVER=breedbase_web:3010
   SGN_REMOTE_SERVER_ADDR=selenium

To debug selenium tests, a VNC viewer can be used, which should be started on the host system.

   gvncviewer localhost

The default password is secret. gvncviewer can be installed using apt install gvncviewer.

Running test automatically

GitHub should be configured using an action such that it runs a test every time a pull request is generated.

For details of the configuration, see .github/workflows/test.yml file.

Running the tests in a virtual machine

  • The selenium2, fixture-based tests should be run using t/test_fixture.pl script.
  • It expects the fixture in t/data/fixture/cxgn_fixture.sql by default.
  • You also have to run the selenium2 server.
  • Download selenium standalone server from here http://www.seleniumhq.org/download/
  • The selenium server needs to be started using {{{java -jar selenium-server-standalone-X.XX.jar }}}

Step by Step Guide to Running Tests in VM

  • cd /dir/where/downloaded/selenium_standalone_jar
  • To run Selenium with the browser visible during tests: java -jar selenium-standalone-server-2.53.1.jar
  • Alernatively to run Selenium in headless mode with no browser during tests: xvfb-run -s "-screen 0, 1920x1080x24" java -jar selenium-server-standalone-2.53.1.jar
  • In an open terminal, cd to cxgn/sgn directory
  • Run all selenium tests: perl t/test_fixture.pl t/selenium2/
  • Run all unit_fixture tests: perl t/test_fixture --noserver t/unit_fixture/
  • Run all unit tests: perl t/test_fixture --noserver t/unit/