-
Notifications
You must be signed in to change notification settings - Fork 3
Writing tests for the testing framework
jkamins7 edited this page Jul 20, 2021
·
9 revisions
You will need to get docker set up on your computer only once, and pull once each time the main branch is updated.
https://www.docker.com/products/docker-desktop
From a terminal, run
docker pull hopkinsidd/choleramappingpipeline
- Clone this repository in a local directory
- Run
docker run -it -v <absolute path to local cholera-mapping-pipeline directory>:/home/app/cmp hopkinsidd/choleramappingpipeline
Any changes you make to files in your cholera-mapping-pipeline directory will also be made on docker and vice versa.
- Create environment variables for your api key and username
export CHOLERA_API_USERNAME=<your_email@wherever>
export CHOLERA_API_KEY=<your_api_key>
- Document and install taxdat
cd ~/cmp/packages/taxdat
Rscript -e 'devtools::document()'
Rscript -e 'install.packages(".", type = "source", repos = NULL)'
- Run tests
cd ~/cmp/packages/taxdat && Rscript -e 'devtools::test()'
cd ~/cmp/tests && Rscript testthat.R
cd ~/cmp/Analysis/R && Rscript run_test.R
Start by making a copy of run_test.R as the basis for your test.
There are lines you can modify (or remove) about how to create the different parts of your test case using the simulation framework.
For some of the more complicated functions, only the default arguments are used and you'll need to use Rstudio's help or ?
to see the rest of the arguments. There are examples of arguments for these functions in create_standardized_testing_data.R