add_testthat | R Documentation |
Wraps use_testthat to add integration testing to a WORCS Project.
As testthat
is primarily geared towards integration tests for
'R' packages, this function conducts testthat
test for WORCS projects.
add_testthat(worcs_directory = ".", ...)
test_worcs(worcs_directory = ".", ...)
worcs_directory |
PARAM_DESCRIPTION, Default: '.' |
... |
Additional arguments passed to other functions. |
No return value. This function is called for its side effects.
No return value. This function is called for its side effects.
if(requireNamespace("withr", quietly = TRUE) &
requireNamespace("testthat", quietly = TRUE)){
withr::with_tempdir({
usethis::create_project(path = ".", rstudio = FALSE, open = FALSE)
add_testthat()
})
}
if(requireNamespace("withr", quietly = TRUE) &
requireNamespace("testthat", quietly = TRUE)){
tmpdr <- file.path(tempdir(), "testworcs")
usethis::create_project(path = tmpdr, rstudio = FALSE, open = FALSE)
usethis::with_project(tmpdr, {
writeLines("", ".worcs")
add_testthat()
usethis::use_test(name = "testme", open = FALSE)
test_worcs()
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.