I'm trying to setup the testthat unit test framework and having some trouble to get the source file location right.
My package folder structure is like below:
.\R\abc.R
.\R\def.R
.\tests\testthat\test_01.R
In my test case file test_01.R, I need to…
I have read up on the differences between expect_equal and expect_identical.
That being said, I have a function which produces a data table that looks like:
Thing1 Thing2 Thing3
Thing1 34.6 23.4 54.2
Thing2 34.7 33.2 32.1
Thing3 …
I have the following R function within a software package, which outputs Sys.time() to the output for users to know how the algorithm is proceeding:
func = function(num1, num2){
result = num1 + num2
return(paste0(' ',…
How can I make my CI pipeline fail if the test stage return errors ?
Here is my test stage :
Test:
stage: Test
script:
- docker build -t r-docker-ci-test -f test.Dockerfile .
- docker run r-docker-ci-test
Here is my test.Dockerfile :…
I'm developing a package that uses your personal email to log in to a website to download some data. When I test the functions using testthat I use my email, but I wouldn't want my email to be uploaded into Github because other users might use it to…
In my package, I'm using testthat and gWidgetRGtk2, I would like to know if there is a way to emulate user actions from the code line, for instance in the following I'm testing an action where the user pushes a button. So far I've been unable to…
I am building a R package, RE and I would like to package a standalone script with it to be placed in RE/exec/wrapper.R. I have written a test function for testthat which works just fine when run from the command line using devtools::test("RE"), but…
I have a small testing program that uses testthat
library(testthat)
source("src/MyFile.r")
results <- test_dir("tests", reporter="summary")
So, I am running this via Rscript. The problem is that the exit code is always 0 even when there were test…
I am testing an R package called eutradeflows on travis. The package contains test programmed with testthat and I would like to see the output of devtools::test() in travis.
There was a line in the main travis log saying :
Status: 4 NOTEs
See …
I am trying to learn TDD while writing a script that transform its input data in a long series of functions. The problem is similar whether I write it in python or R. I guess it's more related to TDD understanding.
# Look of main in python
def…
Would appreciate advice from the community on how best to handle an aggravating situation.
I have a R package that scrapes the National Hurricane Center archives and returns tidy storm data. The website often does not respond.
An example of this…
The package parseMe has a single function
parseMe <- function(text) {
parsed = parse(text = text)
str(parsed) #for diagnosis
getParseData(parse(text = parsed))
}
this function is tested using testthat
test_that('parseMe',{
…
I am trying to write an R package that analyzes Apache Pig GitHub repository with the help of git2r package. I also use testthat package for unit testing.
I have a function, let's call it compute(), which contains code along the lines of:
repo <-…
I'm trying to add a JUnit reporter to testthat. While I can do it inside the package (https://github.com/hadley/testthat/pull/481) I cannot make it pass the same set of tests when in a separate package (https://github.com/lbartnik/testthatJUnit).
My…
I submitted my package to CRAN and it did not pass the CRAN R CMD check.
This is the error they get:
* checking tests ... ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
Type 'contributors()' for more information…