[Rd] unit testing framework for R?

Paul Gilbert pgilbert at bank-banque-canada.ca
Thu Mar 18 00:02:39 MET 2004


Tony

I am interested in this, but there is already a fair amount that can be accomplished within the existing framework. I do something I think of as unit testing, but my code chunks are packages rather than functions. This does not have to be reactive. With a proper makefile setup it can be proactive.

Within a package it should be possible to reflect some of the dependancy structure simply by a naming convention like tests/01test, tests/02othertest, tests/03moretests ....

I am not sure how much will be gained by automatically generating comparison files for the tests. Most of my tests are based on computing numeric values, doing a comparison with known values, and executing stop()if there is a problem. If you could generate those kind of comparisons automatically, then that would be terrific.

Paul Gilbert


-----Original Message-----
From:	A.J. Rossini [mailto:rossini at blindglobe.net]
Sent:	Wed 3/17/2004 4:21 PM
To:	Tony Plate
Cc:	r-devel at stat.math.ethz.ch
Subject:	Re: [Rd] unit testing framework for R?

Tony Plate <tplate at blackmesacapital.com> writes:

> How would a "unit testing" framework look different?  (other than
> maybe the ability to pick and choose tests easily and run them
> quickly).

That is precisely it -- i.e. it's all testing, but it depends on
where and how the tests are intended.

(and then, how easy it is to write tests and run them..).

The basic principle for unit tests is that you can associate a test
with a particular unit of code, and relate the ability to run it to
the function.

So, one approach is to use the tests directory, with a file for
each function with tests, and then have a means to test.  This is
reasonably easy to do. 

The other issue is the ability to group tests by dependencies (again,
more of a UI functionality than a real problem).

So, I think the point I'm trying to hammer at is the interface, not
whether a framework which can be adopted is already in place.

best,
-tony

-- 
rossini at u.washington.edu            http://www.analytics.washington.edu/ 
Biomedical and Health Informatics   University of Washington
Biostatistics, SCHARP/HVTN          Fred Hutchinson Cancer Research Center
UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable
FHCRC  (M/W): 206-667-7025 FAX=206-667-4812 | use Email

CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}}

______________________________________________
R-devel at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel





	[[alternative HTML version deleted]]



More information about the R-devel mailing list