We’re excited to work with you! Post in the issues queue with any questions, feature requests, or proposals.
Quickly setting up a Testing/Demo Environment using Docker¶
The following commands clone this repository and then start a Drupal7Docker container with the the current directory mounted. It also initializes the Tripal site by starting postgresql, installing Tripal and Chado, and preparing the database.
git clone https://github.com/UofS-Pulse-Binfo/tripal_ws_brapi.git cd tripal_ws_brapi docker pull laceysanderson/drupal7dev docker run --publish=8888:80 --name=tdocker -tid --env-file=tests/example.env --volume=`pwd`:/var/www/html/sites/all/modules/tripal_ws_brapi laceysanderson/drupal7dev:latest docker exec -it tdocker /app/init_scripts/startup_container.sh
Next we need to install this module and add test data to the site. The following commands achomplish this given the above setup.
docker exec tdocker /var/www/html/vendor/bin/drush en tripal_ws_brapi tripal_ws_brapi_testdata -y docker exec --workdir=/var/www/html tdocker ./vendor/bin/drush php-script sites/all/modules/tripal_ws_brapi/tripal_ws_brapi_testdata/drush-scripts/loadTestData.php
Now you can proceed by running the automated tests:
docker exec --workdir=/var/www/html/sites/all/modules/tripal_ws_brapi tdocker composer up docker exec --workdir=/var/www/html/sites/all/modules/tripal_ws_brapi tdocker vendor/bin/phpunit
Or manually testing it through http://localhost:8888/web-services.
This module uses Tripal Test Suite. To run tests locally:
cd MODULE_ROOT composer up ./vendor/bin/phpunit
This will run all tests associated with the Tripal WS BrAPI extension module. If you are running into issues, this is a good way to rule out a system incompatibility.
It is highly suggested you ONLY RUN TESTS ON DEVELOPMENT SITES. We have done our best to ensure that our tests clean up after themselves; however, we do not guarantee there will be no changes to your database.
Manual Testing (Demonstration)¶
Using the Testing Helper Module¶
First enable the helper module through the UI or using Drush:
drush en tripal_ws_brapi_testdata
Then go to the provided user interface at https://[yourdrupalsite]/tripalwsbrapi/testdata
The tabbed table shows you all the test data which will be loaded into your site when you click the “Load Test Data” button.
You can edit the test data by editing the CSV files distributed with this helper module. More tables can be added by editing the array of chado table names in the tripal_ws_brapi_testdata.module file.
There is also an interface provided for testing POST calls. This is available at https://[yourdrupalsite]/tripalwsbrapi/testsearch
Using the Database Seeder¶
We have provided a Tripal Test Suite Database Seeder to make development and demonstration of functionality easier. To populate your development database with fake germplasm data:
- Install this module according to the instructions in this guide.
- Run the database seeder to populate the database using the following commands:
cd MODULE_ROOT composer up ./vendor/bin/tripaltest db:seed BrAPIDatabaseSeeder
- To access the web services go to
https:[your drupal site]/web-servicesassuming the default configuration.
NEVER run database seeders on production sites. They will insert fictitious data into Chado.