development:unit_testing_in_r
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| development:unit_testing_in_r [2015/06/30 03:24] – schuemie | development:unit_testing_in_r [2020/04/06 13:51] (current) – schuemie | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | OHDSI unit testing for R follows the standard R practice using test_that: A folder named ' | + | This has moved to https://ohdsi.github.io/MethodsLibrary/ |
| - | + | ||
| - | * A sub-folder called ' | + | |
| - | * A file called ' | + | |
| - | + | ||
| - | The file ' | + | |
| - | + | ||
| - | library(testthat) | + | |
| - | library(< | + | |
| - | test_check("< | + | |
| - | + | ||
| - | + | ||
| - | The sub-folder ' | + | |
| - | + | ||
| - | + | ||
| - | test_that(" | + | |
| - | expect_equal(x(), | + | |
| - | }) | + | |
| - | + | ||
| - | + | ||
| - | ==== When unit tests are performed ==== | + | |
| - | Unit tests are triggered when | + | |
| - | * You manually perform a **check** of the R package (see the Build tab in R-Studio) | + | |
| - | * When the [[OHDSI Travis CI Server]] automatically builds the package after a push to the repository | + | |
| - | + | ||
| - | Your collaborators will appreciate it if you make sure the package passes check before pushing changes to the repository. | + | |
| - | + | ||
| - | ==== Code coverage ==== | + | |
| - | + | ||
| - | We use codecov in combination with the covr package to measure which lines of codes are covered by at least one unit test. Two additions need to be made to .travis.yml to enable code coverage: | + | |
| - | + | ||
| - | * Add **- ./travis-tool.sh install_github jimhester/ | + | |
| - | * Add **- Rscript -e ' | + | |
development/unit_testing_in_r.1435634646.txt.gz · Last modified: by schuemie
