Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »


Rationale

Several classes of tests are created to bring a certain level of completeness in verifying  DataSHIELD functionalities. As a whole, the following aspects are checked:

  • The functions returns some expected and correct values. 
  • Some values are returns repetitively the same outcome
  • The outcomes for some combinations of arguments provides the expected behaviour
  • The disclosure control has not been breached

Syntax and imports

To check the files are syntactically correct and all the relevant imports have been declared, you can use the following function.

devtools::check()


Additional reading:

Devtools CRAN documentation

Summary of tests


Type of testShort nameTest typeDescription
Mathematically correctmathtestthat

Verify some mathematical properties hold for a function. This type of tests relies 

on the TESTING datasets available locally and the testing virtual machines. 

Expected valuesexpttestthat

Test the outcomes matches some expected values computed by R. This type of tests relies on the TESTING datasets available locally and the testing virtual machines.

SmokesmktestthatIs it invokable without catching fire?
Smoke expected valuessmk_expttestthatExpected values style smoke tests, often only checking results are repeated.
Arguments checkingargtestthatDoes it behave as expected when unexpected arguments are passed to functions?
Disclosure controldisctestthatDoes it adhere to the disclosure control settings?

Testthat contexts

For the testthat tests we use the 'context' to use define types of test. The short name must be from the short name list above and follow the format below. We also allow a modifier to make it more specific (e.g. poisson or gaussian if the function has different behaviour between the two). Additionally we add a 'single' or 'multiple' tag to specify if it is testing a single remote source or multiple remote sources. The context are name using this notation across all the tests.

Naming convention of contexts
[name of the function]::[type of test]::[purpose]::[single or multiple]
Example contextsExample test file names

ds.mean::smk

test-smk-ds.mean.R

ds.mean::multiple

test-smk-ds.mean.R

ds.mean::smk::gaussian

test-smk-ds.mean.R

ds.mean::smk::gaussian::single

test-smk-ds.mean.R

ds.mean::math::something::multiple

test-math-ds.mean.R

ds.mean::expt::something::singletest-expt-ds.mean.R

Examples of tests

Writing some tests

  • No labels