Skip to content

Unit Tests

Raphael Sonabend edited this page Jul 2, 2019 · 1 revision

We try to ensure a high code coverage in the distr6 package at all times, to maintain this we will not accept pull requests that make changes to code or add new functionality without proper unit-tests that assess the code. By 'proper' unit-tests we mean tests that check the function (or class) run without error (when appropriate), return outputs as expected and are in line with test-that conventions (i.e. usage of contexts, well structured and partitioned test-that expressions).

All our unit-tests are run in every local R CMD check and on Travis and Appveyor CI. To ensure these run properly we have all tests in a dedicated 'tests/testthat' folder, please see these for examples of our unit-tests. Every test file is named with the same pattern test-Class/fun.R where Class/fun is the name of the class or function that you are testing. We allow abbreviations in script names as long as it is immediately clear what is being tested. Similarly please ensure that the 'context' of the file is clearly named so that it can be read in any CI fail logs.

See here for a guide to 'test-that' and here for a short introduction to unit testing in Travis.

Clone this wiki locally