开发者

Can't find SummaryReporter output

I've looked everywhere but I can't find where 开发者_StackOverflow中文版SummaryReporter writes the tests report? If there's a single failure the script stops with an error. Ideally, all tests would be run and results outputted to a file.


There is a very good documentation about the testthat package at this wiki: https://github.com/hadley/devtools/wiki/Testing

In a nutshell, you can embed multiple expect_that statements in each test_that.

Towards the end of the page, in the section 'Testing files and directories' there is information about the three different reporters (stop, minimal and summary).

I have found this to be quite robust. Even if test_that finds an error, it simply reports the error and carries on with the remainder of the tests.

PS. My experience is that the test results are printed to the console. I run my testing from within the R environment, not the OS command line.


SFun28, This may happen as your reporter is set to stop reporter as default.

Take a look at hadley's R paper on testing (see page 8):

testthat comes with three reporters: stop, minimal and summary. The stop reporter is the default and stop()s whenever a failure is encountered; the summary report is the default for test_file and test_dir.

Try specifying another reporter, so add this to your test_file call.

test_file("tests/test-mycode.R", reporter = "minimal")

or

test_file("tests/test-mycode.R", reporter = "tap")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜