[Bioc-devel] testthat instructions for website

Dan Tenenbaum dtenenba at fredhutch.org
Sat Mar 14 02:13:14 CET 2015

----- Original Message -----
> From: "Michael Love" <michaelisaiahlove at gmail.com>
> To: bioc-devel at r-project.org
> Sent: Friday, March 13, 2015 6:06:39 PM
> Subject: [Bioc-devel] testthat instructions for website
> hi Bioc team,
> Can we add some testthat instructions to the unit testing page:
> http://bioconductor.org/developers/how-to/unitTesting-guidelines/
> I presume the instructions would be simply to follow the basic
> testthat instructions, e.g.:
> https://github.com/hadley/testthat/blob/master/README.md
> http://r-pkgs.had.co.nz/tests.html
> ...add testthat to Suggests, put tests in files starting with 'test'
> inside tests/testthat/ and write a file tests/testthat.R with
> specific
> code in it. I think this is what the packages here are all doing:
> http://bioconductor.org/help/search/index.html?q=testthat

One thing to be aware of is that if a package uses RUnit and has a unit test fail, the detailed output of the failed test will be in the build report. If a package uses testthat and has a test fail, the detailed output will NOT be in the report. So the build system needs to be tweaked to support this. Until that happens, I hesitate to recommend that people use testthat because they won't get to see the detailed output that they can see uf they use RUnit.


> best,
> Mike
> ~~~~ end of request, details continue below ~~~~
> My reasons for wanting that Bioconductor support testthat in addition
> to RUnit is that RUnit does not make it very simple to run all tests,
> which should be a very simple thing to do.
> With testthat, this is simply a call to test() which lives in
> devtools. With RUnit you have to do:
> runTestSuite(defineTestSuite("myTest", "inst/unitTests/","test_"))
> Although that's not quite enough. That will not run the same test as
> Bioconductor, or as if you ran the code in the test files in your
> console, because defineTestSuite picks rngKind =
> "Marsaglia-Multicarry" and rngNormalKind = "Kinderman-Ramage", which
> are not the current R default random number generators.
> So then you have to do:
> runTestSuite(defineTestSuite("myTest", "inst/unitTests/","test_",
> rngKind = "default", rngNormalKind = "default"))
> Or you could call BiocGenerics:::testPackage(), but we probably all
> agree it's better that unit testing have a documented, exported
> function.
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

More information about the Bioc-devel mailing list