When to mock and what to mock in a Web API?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com
featured
Stream - Scalable APIs for Chat, Feeds, Moderation, & Video.
Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.
getstream.io
featured
  1. gomock

    Discontinued GoMock is a mocking framework for the Go programming language. (by golang)

    Normally I like to generate everything with Mockgen and test it using table driven test.

  2. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  3. dockertest

    Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.

    If your project is relatively simple and you can get away with recreating your scenarios against a real mock database and run other related services locally. It would be good to setup docker containers for your test scripts and write e2e tests. I believe e2e tests are harder but more useful in understanding/reasoning how users are impacted.

  4. vcr

    Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.

    If you had bit more complex workflows or less time - you could start using a VCR library to mock out API interactions and then continue with your dockerised DBs.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • How to unit test your database interactions with Docker

    4 projects | /r/golang | 24 Mar 2023
  • how to mock DBs

    13 projects | /r/golang | 30 May 2022
  • [HELP] Testing SQL queries and functions that use SQL queries in Golang.

    3 projects | /r/golang | 1 Dec 2021
  • Take it easy with Graphite and Docker 🐳

    2 projects | dev.to | 28 May 2025
  • Using testcontainers to improve performance in integration tests

    2 projects | dev.to | 21 May 2025

Did you know that Go is
the 4th most popular programming language
based on number of references?