Skip to content
Prev 168777 / 398502 Next

Test Driven Development in R

Hi, Jose: 

      How does the following

      I have not studied "Test Driven Development", but I routinely 
write documentation "*.Rd" files before I write code, and the 
documentation files include test cases in the "\examples" section.  With 
"\dontshow", I hide tests that I don't think would benefit a user. 

      The source for the 'fda' package includes numerous constructions 
like the following: 


\dontshow{stopifnot(}
all.equal(fRegressout, knee.hip.f)
\dontshow{)}


      Here, "fRegressout" and "knee.hip.f" are two different objects 
that should theoretically be equal.  I show the user that they are in 
fact equal, but I don't bother the user with the "stopifnot" call that 
will stop "R CMD check" to let me know that the code fails this test.  I 
have not used "Runit", but it's on my "to do" list.  "Sciviews-K" sounds 
interesting, but I have not used it. 

      Also, Chambers (2008) Software for Data Analysis (Springer) says 
that "trustworthy software" is "The Prime Directive".  TDD sounds like 
it would support that goal. 

      I will not be able to attend useR 2009 but would be interested in 
a further discussion of this issue. 

      Best Wishes,
      Spencer Graves
Tobias Verbeke wrote: