04 / 04

How would you set up a testing strategy for a fullstack Go backend with React frontend?

Difficulty: 6/10
unit testing, integration testing, CI/CD

Layer tests by cost and speed: unit tests for domain logic, integration tests for DB and services, contract tests for HTTP API, and E2E tests for critical user flows using Playwright.

Testing pyramid layers
  1. 1

    Unit tests: pure functions, domain logic, error handling — fast, no I/O, run on every commit

  2. 2

    Integration tests: repository + real DB (testcontainers), service + message queue — run on PR

  3. 3

    API contract tests: HTTP handlers with httptest.NewServer + real DB — verify request/response shapes

  4. 4

    E2E tests: Playwright/Cypress against a deployed staging environment — run before production deploy

  5. 5

    Race detector: go test -race in CI catches data races missed by functional tests

HTTP handler test with httptest

Scenario Questions

0-2 years experience

  1. 1You need to add unit tests for a new Go handler that returns JSON. Walk me through how you'd set up the test file and which tools you'd use.
  2. 2For the React component that displays a list fetched from the Go API, how would you write a test to verify it renders correctly with mock data?
  3. 3If a test for your Go service fails locally but passes in CI, what steps would you take to investigate?

2-5 years experience

  1. 1We want to introduce integration tests that spin up the Go server and the React app. What approach would you take, and why might you choose Docker Compose over a mock server?
  2. 2A teammate reports that the end‑to‑end test suite became flaky after a recent auth change. How would you debug and stabilize it?
  3. 3Explain the trade‑offs between running Go tests in parallel versus serially when they share a test database.

5-8 years experience

  1. 1Our service handles 10k requests per second and the CI pipeline runs the full test suite on every PR. How would you design a testing strategy that keeps feedback fast while maintaining confidence at scale?
  2. 2We need to ensure contract compatibility between the Go API and the React frontend across multiple versions. What testing patterns would you put in place and how would you enforce them?
  3. 3If we decide to migrate from a monolithic test suite to a micro‑service‑oriented testing framework, what architectural changes would you prioritize?

8+ years experience

  1. 1The company plans to adopt a unified testing platform across several product teams, each with Go backends and various frontends. How would you define standards, tooling, and governance to make this sustainable?
  2. 2We have legacy Go services without tests and a React codebase with ad‑hoc tests. Design a phased migration plan to bring both sides up to a modern testing strategy without blocking feature delivery.
  3. 3When evaluating a cloud‑based CI/CD solution that promises auto‑scaling test runners, what criteria would you use to decide if it fits our full‑stack Go/React testing needs?

Follow-up Questions

  • How would you handle flaky tests that depend on external services?
  • What metrics would you track to keep the test suite healthy?
  • Can you share an example where a contract test caught an API‑frontend regression?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.