Learn R Programming

usethis (version 3.1.0)

use_test_helper: Create or edit a test helper file

Description

This function creates (or opens) a test helper file, typically tests/testthat/helper.R. Test helper files are executed at the beginning of every automated test run and are also executed by load_all(). A helper file is a great place to define test helper functions for use throughout your test suite, such as a custom expectation.

Usage

use_test_helper(name = NULL, open = rlang::is_interactive())

Arguments

name

Can be used to specify the optional "SLUG" in tests/testthat/helper-SLUG.R.

open

Whether to open the file for interactive editing.

See Also

Examples

Run this code
if (FALSE) {
use_test_helper()
use_test_helper("mocks")
}

Run the code above in your browser using DataLab