The goal of validation is to provide an easy approach for the documentation and implementation of package and function tests for the SCTO R validation project. Package validations themselves can be found in the pkg_validation repository.
Installation
You can install the development version of validation from GitHub with:
# install.packages("devtools")
devtools::install_github("SwissClinicalTrialOrganisation/validation")
Testing
The package contains a test
function which is used to run all tests for a named package.
library(validation)
## basic example code
# test("presize")
Implementing new tests
All tests are stored in the validation_tests
repository in package specific folders. E.g. the tests/presize
folder contains tests relevant to the presize
package.
(At least) three files are required. The test_skeleton function can be used to create these files.
- setup-
package
.R - info.txt
- test-
function
.R
The setup-package.R
file installs, updates and/or loads the package being tested and any other relevant steps (e.g. loading a dataset).
info.txt
contains a plain text description of the tests.
test-function
.R contains the tests themselves. Tests should be written using testthat
syntax, e.g.