The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The goal of testthatmulti is to enhance the R package testthat
so that noisy tests can be run. If a test fails 1% of the time, it can cause problems with R packages. By allowing each test multiple attempts to pass, unexpected and rare test failures can be avoided.
You can install the development version of testthatmulti from GitHub with:
For example, suppose you have a test that passes 99% of the time. This can happen when tests are run using randomly generated data, such as for modeling or optimization.
set.seed(153)
library(testthat)
x <- runif(1)
cat('x is', x, '\n')
#> x is 0.9975921
expect_true(x < .99)
#> Error: x < 0.99 is not TRUE
#>
#> `actual`: FALSE
#> `expected`: TRUE
This test will usually pass, but could fail occasionally and cause problems when submitting to CRAN.
To give the test multiple chances to pass, wrap the function ttm
around the code for the tests and tell it how many times to run the tests. It will succeed if all the tests are passed on any single iteration. In the code for the tests, replace expect_true
with ttm_expect_true
and expect_equal
with ttm_expect_equal
.
Below, we run the same test as above, but give it 3 chances to pass. By giving it 3 attempts to pass the test, the probability of failure drops from 1% to 0.0001%
set.seed(153)
library(testthatmulti)
ttm(10, {
x <- runif(1)
cat('x is', x, '\n')
ttm_expect_true(x < .99)
})
#> x is 0.9975921
#> x is 0.4970875
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.