mkirk mkirk - 1 year ago 139
R Question

stubs and mocks in R

I've spent lots of time with RSpec and some time with xunit style tests. I've gotten accustom to having mocks and stubbing at my disposal.

Is there anything like mocks or stubbing in R? What frameworks have them?

If not how do you isolate your tests?

Answer Source

It wasn't available until 4 years after you asked this question, but it looks like testthat does include a with_mock() function now:

Seems to fit the bill pretty well.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download