Title: | Automatic Package Testing |
---|---|
Description: | Automatic testing of R packages via a simple YAML schema. |
Authors: | Mark Padgham [aut, cre] , Jouni Helske [ctb] |
Maintainer: | Mark Padgham <[email protected]> |
License: | GPL-3 |
Version: | 0.0.2.211 |
Built: | 2024-11-22 06:08:59 UTC |
Source: | https://github.com/ropensci-review-tools/autotest |
Generate a 'yaml' template for an 'autotest'.
at_yaml_template(loc = tempdir())
at_yaml_template(loc = tempdir())
loc |
Location to generate template file. Append with filename and '.yaml' suffix to overwrite default name of 'autotest.yaml', otherwise this parameter will be used to specify directory only. |
Other yaml:
autotest_yaml()
,
examples_to_yaml()
This function exists only to provide the class definitions for test objects, and is not intended to be called directly.
autotest_obj( package = NA_character_, package_loc = NULL, test_name = NA_character_, fn_name = NA_character_, parameters = list(), parameter_types = NA_character_, class = NULL, classes = NULL, env = new.env(), test = FALSE, quiet = FALSE )
autotest_obj( package = NA_character_, package_loc = NULL, test_name = NA_character_, fn_name = NA_character_, parameters = list(), parameter_types = NA_character_, class = NULL, classes = NULL, env = new.env(), test = FALSE, quiet = FALSE )
package |
Name of package for which object is to be constructed. |
package_loc |
Location of package on local system (for source packages only) |
test_name |
Name of test (use autotest_types to get all test names). |
fn_name |
Name of function to be tested. |
parameters |
Names of all parameters for that function. |
parameter_types |
Types of input parameters. |
class |
Class of an individual parameter. |
classes |
Classes of all parameters. |
env |
Environment in which tests are to be run. |
test |
If |
quiet |
If |
Automatically test an entire package by converting examples to yaml
format
and submitting each to the autotest_yaml function.
autotest_package( package = ".", functions = NULL, exclude = NULL, test = FALSE, test_data = NULL, quiet = FALSE )
autotest_package( package = ".", functions = NULL, exclude = NULL, test = FALSE, test_data = NULL, quiet = FALSE )
package |
Name of package, as either
|
functions |
Optional character vector containing names of functions of nominated package to be included in 'autotesting'. |
exclude |
Optional character vector containing names of any functions of nominated package to be excluded from 'autotesting'. |
test |
If |
test_data |
Result returned from calling either autotest_types or
autotest_package with |
quiet |
If 'FALSE', provide printed output on screen. |
An autotest_package
object which is derived from a tibble
tbl_df
object. This has one row for each test, and the following nine
columns:
type
The type of result, either "dummy" for test = FALSE
, or one
of "error", "warning", "diagnostic", or "message".
test_name
Name of each test
fn_name
Name of function being tested
parameter
Name of parameter being tested
parameter_type
Expected type of parameter as identified by
autotest
.
operation
Description of the test
content
For test = FALSE
, the expected behaviour of the test; for
test = TRUE
, the observed discrepancy with that expected behaviour
test
If FALSE
(default), list all tests without implementing them,
otherwise implement all tests.
yaml_hash' A unique hash which may be be used to extract the
yaml'
specification of each test.
Some columns may contain NA values, as explained in the Note.
Some columns may contain NA values, including:
parameer
and parameter_type
, for tests applied to entire
functions, such as tests of return values.
test_name
for warnings or errors generated through "normal"
function calls generated directly from example code, in which case type
will be "warning" or "error", and content
will contain the content of
the corresponding message.
Other main_functions:
autotest_types()
List all types of 'autotests' currently implemented.
autotest_types(notest = NULL)
autotest_types(notest = NULL)
notest |
Character string of names of tests which should be switched off
by setting the |
An autotest
object with each row listing one unique type of test
which can be applied to every parameter (of the appropriate class) of each
function.
Other main_functions:
autotest_package()
Automatically test inputs to functions specified in a 'yaml' template.
autotest_yaml( yaml = NULL, filename = NULL, test = TRUE, test_data = NULL, quiet = FALSE )
autotest_yaml( yaml = NULL, filename = NULL, test = TRUE, test_data = NULL, quiet = FALSE )
yaml |
A 'yaml' template as a character vector, either hand-coded or potentially loaded via readLines function or similar. Should generally be left at default of 'NULL', with template specified by 'filename' parameter. |
filename |
Name (potentially including path) of file containing 'yaml' template. See at_yaml_template for details of template. Default uses template generated by that function, and held in local './tests' directory. |
test |
If |
test_data |
Result returned from calling either autotest_types or
autotest_package with |
quiet |
If 'FALSE', provide printed output on screen. |
An autotest_pkg
object, derived from a tibble, detailing
instances of unexpected behaviour for every parameter of every function.
Other yaml:
at_yaml_template()
,
examples_to_yaml()
## Not run: yaml_list <- examples_to_yaml (package = "stats", functions = "reshape") res <- autotest_yaml (yaml = yaml_list) ## End(Not run)
## Not run: yaml_list <- examples_to_yaml (package = "stats", functions = "reshape") res <- autotest_yaml (yaml = yaml_list) ## End(Not run)
Convert examples for a specified package, optionally restricted to one or more specified functions, to a list of 'autotest' 'yaml' objects to use to automatically test package.
examples_to_yaml( package = NULL, functions = NULL, exclude = NULL, quiet = FALSE )
examples_to_yaml( package = NULL, functions = NULL, exclude = NULL, quiet = FALSE )
package |
Name of package, as either
|
functions |
If specified, names of functions from which examples are to be obtained. |
exclude |
Names of functions to exclude from 'yaml' template |
quiet |
If 'FALSE', provide printed output on screen. |
Other yaml:
at_yaml_template()
,
autotest_yaml()
Expect autotest_package()
to be clear of errors
expect_autotest_no_err(object)
expect_autotest_no_err(object)
object |
An |
(invisibly) The same object
Other expectations:
expect_autotest_no_testdata()
,
expect_autotest_no_warn()
,
expect_autotest_notes()
,
expect_autotest_testdata()
Expect autotest_package()
to be clear of errors with no tests switched off
expect_autotest_no_testdata(object = NULL)
expect_autotest_no_testdata(object = NULL)
object |
Not used here, but required for |
(invisibly) The autotest object
Other expectations:
expect_autotest_no_err()
,
expect_autotest_no_warn()
,
expect_autotest_notes()
,
expect_autotest_testdata()
Expect autotest_package()
to be clear of warnings
expect_autotest_no_warn(object)
expect_autotest_no_warn(object)
object |
An |
(invisibly) The same object
Other expectations:
expect_autotest_no_err()
,
expect_autotest_no_testdata()
,
expect_autotest_notes()
,
expect_autotest_testdata()
Expect test_data
param of autotest_package
to have additional note
column explaining why tests have been switched off.
expect_autotest_notes(object)
expect_autotest_notes(object)
object |
An |
Other expectations:
expect_autotest_no_err()
,
expect_autotest_no_testdata()
,
expect_autotest_no_warn()
,
expect_autotest_testdata()
Expect autotest_package()
to be clear of errors with some tests switched
off, and to have note column explaining why those tests are not run.
expect_autotest_testdata(object)
expect_autotest_testdata(object)
object |
An |
(invisibly) The autotest object
Other expectations:
expect_autotest_no_err()
,
expect_autotest_no_testdata()
,
expect_autotest_no_warn()
,
expect_autotest_notes()