Skip to content

Testing Framework

jwildfire edited this page Aug 11, 2021 · 2 revisions

Overview

The safetyGraphics package includes both standard unit tests for the supporting R functions via the testthat package and automated browser tests for the shiny application via the shinytest package.

Unit tests for R functions

Unit testing is done using the testthat package. Most supporting R functions have unit tests in the /tests/testthat/ folder, and, generally speaking, tests should be added or updated whenever a file in the /R folder is created or changed. Unit tests are run automatically (via TravisCI) any time code is pushed to github and also when a release is sent to CRAN.

Developers can run devtools::test() to run the tests manually.

Automated tests for Shiny Application

Automated testing for the shiny application is done using the shinytest package. Several common use cases have been recorded so that they can automatically be re-run anytime the application is updated. At this time, Shiny tests are not run automatically (via TravisCI) any time code is pushed to github nor when a release is sent to CRAN - though we plan to add that functionality in a future release.

Developers can run testApp("inst/eDISH_app") to run the tests manually.