Skip to content

Discuss Testing Infrastructure: Use {testthat} + {webfakes} for Offline API Simulation #3

@ramiromagno

Description

@ramiromagno

hey @lucassantosbicalho,

As we begin development of the {odsql} R package, we need to set up a reliable and reproducible testing infrastructure. It's important that our tests:

  • Do not depend on an active internet connection
  • Avoid hitting real endpoints repeatedly
  • Support deterministic responses and edge case simulation
  • Run quickly and consistently across environments (e.g., CI)

Proposal

I suggest we use:

  • {testthat} as our unit testing framework
  • {webfakes} to spin up a local HTTP server that mimics Opendatasoft’s API responses for testing purposes

This approach gives us complete control over:

  • Mock datasets and responses (including query parameters)
  • Simulating pagination, 404s, 401s, or malformed data
  • Timing behavior (slow or failing endpoints)
  • Facet and metadata endpoints

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions