0

how to do automatic tests after package build in R - Rstudio - testthat

i have tried:

testPath=paste(getwd(),"/tests/R/",sep="")
codePath=paste(getwd(),"/R/",sep="")
auto_test(test_path=testPath, code_path=codePath)

but this react each time i change a file, not each time i rebuild my package... it works for now... but if my package becomes bigger that will just take to much time... also i like to have my console available during coding... (don't like the idea of a 2nd console)

phonixor
  • 1,623
  • 13
  • 18
  • 1
    I'll post as a comment for now and if it's what you want I'll clean up as an answer. Basically you need to make a directory in the main repo called `tests`. In there you a file called `testthat.R` (I don't think the name has to be that but I copied Hadley's repo) and another directory called `testthat` with all the unit test .R files. So the best way is to go steal from the master: https://github.com/rstudio/ggvis See the `tests` directory? This approach does the unit testing during the build. – Tyler Rinker Jun 20 '14 at 13:07
  • i did that... it does not do the checking after the build... it does do the checking if you type: "check()" or press: ctrl+shift+t ... which is getting close – phonixor Jun 20 '14 at 14:29
  • It does it during the build as part of the checks. See the travis-ci output here:https://travis-ci.org/trinker/qdap I's the line that says: `* checking tests ... Running ‘testthat.R’ [21s/22s]` – Tyler Rinker Jun 20 '14 at 14:32
  • this is all i get... `* installing *source* package ‘readODS’ ...` `** R` `** preparing package for lazy loading` `** help` `*** installing help indices` `** building package indices` `** testing if installed package can be loaded` `* DONE (readODS)` and it does not run the test... cause i made sure it would fail!... you know to test the testing :) – phonixor Jun 20 '14 at 14:41
  • Do you have the repo in a place it can be forked? Do you have build as `--as-cran`? – Tyler Rinker Jun 20 '14 at 15:21
  • https://github.com/phonixor/readODS - already on CRAN btw and yes i used --as-cran for the check() thing. – phonixor Jun 24 '14 at 14:55

0 Answers0