Skip to contents

Test whether design steps can be processed and produce valid output for each possible choice.

Usage

test_design(
  d,
  input = NULL,
  input_test_code = NULL,
  output_test_code = NULL,
  ...
)

Arguments

d

A character vector of the research design steps function names

input

input parameter of the first step. Can be either data (passed to first step as is) or a function. If it is a function, the function is called to generate the input data. If you do not provide input then only step_description, choice_description and choice_type of each step are tested for consisitency. If input is provided, you also need an R code file to test input for validity.

input_test_code

A path to an R file containg test code to verifiy the integrity of input data.

output_test_code

A character vector of a length equal to the length of d containing paths to test code files for each step's output.

...

Are passed to testthat::test_file()

Value

The return value testthat::test_file()

Details

If called without parameters for input, only the choice_type list structure is tested for consistency. If input is provided, data steps are tested across all choices to verify that they produce structually valid output without errors or warnings. If input_test_code is provided this test code is used to verify input. If output_test_code is provided each step's output is tested. See the vignette of the package for further details.

Examples

if (FALSE) {
  print("Sorry. No examples yet.")
}