Skip to content

[R-pkg-devel] toy example for testing purpose

3 messages · Zhang, Xueqiong, Uwe Ligges

#
On 16.08.2022 20:28, Zhang, Xueqiong wrote:
Well, ideally you have short examples so that users see quickly how your 
function can be called. Ideally examples take less than 5 sec., becuase 
users are typically not very patient when runningn exmaples from help pages.

If your examples are lengthy we ask you to put them in \donttest{} but 
try to provide short ones in addition to the lengthy ones (rather 
provide some tiny toy data, use few iterations etc)

If all ends up in \donttest{}, no vignette runtime code and no tests, 
your packages won't have any code executed at runtime which is of course 
a vey bad idea. SAo we ask to provide tests in case you do not provide 
examples that get auto-executed during the checks.
In vignettes we typically see a workflow tested, but not all 
functionality of the package, and frequently only subseta of provided 
functions get executed in vignettes...

Best,
Uwe Ligges
#
Hi Dr Ligges and team,
Thanks for the explanation. it makes sense to me now!
I am working on putting examples in testthat folder, hope it?s the right way to do it.

Joan Zhang, MS
Research Informatics Analyst
Larsen Lab - Emory Transplant Center


From: Uwe Ligges <ligges at statistik.tu-dortmund.de>
Date: Wednesday, August 17, 2022 at 10:46 AM
To: Zhang, Xueqiong <joan.zhang at emory.edu>, r-package-devel at r-project.org <r-package-devel at r-project.org>
Subject: [External] Re: toy example for testing purpose
On 16.08.2022 20:28, Zhang, Xueqiong wrote:
Well, ideally you have short examples so that users see quickly how your
function can be called. Ideally examples take less than 5 sec., becuase
users are typically not very patient when runningn exmaples from help pages.

If your examples are lengthy we ask you to put them in \donttest{} but
try to provide short ones in addition to the lengthy ones (rather
provide some tiny toy data, use few iterations etc)

If all ends up in \donttest{}, no vignette runtime code and no tests,
your packages won't have any code executed at runtime which is of course
a vey bad idea. SAo we ask to provide tests in case you do not provide
examples that get auto-executed during the checks.
In vignettes we typically see a workflow tested, but not all
functionality of the package, and frequently only subseta of provided
functions get executed in vignettes...

Best,
Uwe Ligges

  
  
#
On 17.08.2022 16:51, Zhang, Xueqiong wrote:
Writing R Extensions well explains how to use the tests directory.
testthat is a contributed package which its own documentation.

Best,
Uwe Ligges