Open utterances-bot opened 3 years ago
Thanks for nicely filling up the missing part in our earlier discussion.
One point I am missing: I have tests that have to be run manually, because they are integration tests for an API hitting a live server. I add these as sibblings of testthat
:
test
testthat.R
/testlive
helper-globals-live.R
run-testlive.R
/testthat
/testdata
Using httptest
, the testthat directory either contacts the apiary server to create the response files, (https://odkcentral.docs.apiary.io/), or uses the response files as a mock in travis/CRAN.
I put the testdata shared between unit-test and integration tests in another sibbling directory.
Any comments or better ideas?
Thanks for reading!
I think it sounds ok? In the Whole Games section of https://books.ropensci.org/http-testing/ I suggest some workflows for tests with real requests but yours seems to work 🙂
Aside question, what does your package do compared to https://docs.ropensci.org/ruODK/?
It is a complement to ruODK, which I also use. ruODK is focused on getting the data for offline-reading. odkapi is strict REST API, using XSLT for conversion of all output to data frames. And it is lean, using no tidyverse. I am not ideologically opposed to tidyverse and use it every day writing fire-and-forget reports, but I have three package (breathtestXXX, gastempt) that use it, and the amount of work I put into keeping up with tidyverse changes is just to massive. 75% tidyverse problems, 20% rstan/rcpp.
I use it to build a highly simplified form upload/test RGui for clinical use. The official Web Interface one is highly confusing for end users and will never pass usage tests in a clinical context. Even if I use it the web interface daily, I never find the place where to get the test or the user QR code. Or been thrown back to rename the form when I upload it . Or the confusing warning that cannot be switched off that the repeat behaviour has changed.
Aside question, what does your package do compared to https://docs.ropensci.org/ruODK/?
Which I clearly have read.... Since I had used httptest before, I sticked with it, even if you prefer vcr and friends.
The http testing book is getting updated, I added a chapter about httptest yesterday 😉
Bummer -- when do you have time to do your real work .:)
I stumbled upon this post again while reading https://ropensci.org/blog/2023/07/21/news-july-2023/#package-development-corner.
Would you say that the statement
tests/testthat/helper*.R
are no longer recommended in testthat but they are still supported. 😌
is still true?
These helper files are mentioned, without any mention of them being deprecated, in a somewhat new testthat vignette (https://github.com/r-lib/testthat/pull/1769): https://testthat.r-lib.org/articles/special-files.html#helper-files
I think they'll be supported forever but I'm not sure they're recommended? I use them a lot in any case. :sweat_smile:
Helper code and files for your testthat tests - R-hub blog
https://blog.r-hub.io/2020/11/18/testthat-utility-belt/