Skip to content

Use mockr to write unit tests #14

Description

@isteves

From #13:

For your issue of wanting to test your processing code with a formal unit test, your intuition is right on. The way people like to do this is to make what's called a mock. It's basically what you said: save a copy of some response to some function call that usually is slow/can fail/etc and test that. This makes unit test unit tests and not integration tests!

I haven't done this directly with testthat, but there appears to be support: https://github.com/r-lib/testthat/blob/master/R/mock.R. Also see https://www.mango-solutions.com/blog/testing-without-the-internet-using-mock-functions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backlogThe issue has been put on the back burnerenhancementNew feature or request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions