문제

I've looked everywhere but I can't find where 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")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top