Good resources for testthat's "Reporters"?

testthat

#1

I found a curious Reporter, JunitReporter in the NEWS of the next version of testthat package and tried to use it, but I couldn’t find the good way to work with Reporters.

Since Googling around and ?Reporters didn’t help, I searched other people’s codes on GitHub and anticipated the code will be something like this:

test_check("mypackage",
           reporter = JunitReporter$new(file = "junit_result.xml"))

But, I’m not sure this is the right way… Are there any good documentations about how to use (or implement) Reporters? Any suggestions are appreciated.


#2

Here are some examples from CRAN packages:
https://github.com/search?q=user%3Acran+test_check+reporter&type=Code&utf8=%E2%9C%93

E.g.

test_check('rnbn', reporter = 'summary')

#3

Thanks! Searching on GitHub (and copying and pasting) is exactly what I did to write up the code above :slight_smile:
Do you know some documentations?


#4

I don’t think there is currently great documentation on testthat reporters. I opened https://github.com/r-lib/testthat/issues/657 to add a reporter vignette in the future.


#5

Thanks so much! I’ll keep my eyes on the issue :slight_smile: