json_test: Wrapper function to run tests and compare with reference

Description Usage Arguments

View source: R/json_test.R

Description

Wrapper function to run tests and compare with reference

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
json_test(
  func = NULL,
  package = NULL,
  test_id = NULL,
  tests = NULL,
  reference = NULL,
  delta = NULL,
  max_time = NULL,
  run = NULL,
  skip = c(),
  force = c(),
  list_as_args = TRUE,
  ignore_keys = c(),
  parse_functions = list(),
  overwrite = NULL,
  fail_if_not_exists = TRUE,
  lib = "testit",
  verbose = FALSE
)

Arguments

func

linking to test/reference JSON and function in package to test

package

package name from where to take tests.json object from

test_id

specifies test/reference JSON to use, i.e. /home/user/R/3.3/package_name/test/<test_id>.json. If not specified, assumes 'func' is used as 'test_id'.

tests

a vector of tests to run

reference

list of reference values

delta

relative allowed imprecision, default is 0.03. Overrides value specified in reference JSON.

max_time

maximum time the test should take to run

run

a specific test to run only, no actual check. The output object will be returned.

skip

a vector of tests to skip (default is to run all)

force

a vector of test to override potential 'skip'.

list_as_args

should the list elements from the JSON be used as arguments to the function? TRUE by default. If FALSE, the list as a whole will be passed to the 'args' argument of the function.

ignore_keys

ignore specific keys in reference JSON, e.g. to allow for comments

parse_functions

list of functions to parse specific JSON tests data before calling the function. This is sometimes useful due to the back-serialization from JSON to R object.

overwrite

optional list specifying what keys of test JSON to manually overwrite with given values

fail_if_not_exists

fail if folder with JSON does not exist?

lib

which test library to use (testit or testthat)

verbose

verbosity


InsightRX/json2test documentation built on May 12, 2021, 9:49 p.m.