The Hardest Part of Writing Tests is Getting Started
Getting a test suite started is the hardest part of testing, so begin with small, incremental steps. First write a trivial test and confirm it can both pass and fail. Next test isolated functions that have no dependencies. Then use stubs and saved API-response fixtures, scrubbed of sensitive data, to isolate code from external services. Finally, add end-to-end tests: in one ETL project, stubbing the API client and testing against a real database reached over 80% code coverage, and the same approach is recommended for refactoring untested legacy code.
Related posts
- Achieving Test Reliability for Native E2E Testing: Beyond Fixing Broken Tests
Docker mediumAdeptPatching flaky native E2E tests one by one failed to improve reliability over more than a year. Historical failure analysis showed much of the noise came from unstable environments and shared test account state. The fix was infrastructure: isolated pre-prod or ephemeral environments, standardized containerized emulators, fresh test accounts per session, and mocked feature-flag and A/B responses. On the process side it recommends feature-based test ownership with a single point of contact per flow, remotely muting known-flaky tests, enriched alerts and tracked flakiness trends, plus a hybrid setup running Dockerized Android emulators on PRs and real device farms periodically.
- Database testing with fixtures and seeding
Neon mediumAdept
Seeding and fixtures solve different problems when populating databases for testing. Static seeds load fixed, version-controlled, idempotent reference data an app needs to run (admin users, countries and states), shown with Django scripts and Rails `db:seed`. Dynamic seeds generated with Faker supply large or randomized datasets for load and edge-case testing. Fixtures are framework-integrated, per-test datasets (e.g. Django YAML fixtures loaded in TestCase) that are set up and torn down around each test. Neon's database branching is pitched as a complement for isolated, resettable test environments.
- Autonomous testing of services at scale
Meta Engineering mediumAdeptMeta built an integration testing framework for back-end services that reuses production containerization and routing to spin up ephemeral test environments, with per-service boundaries where requests go to local services, in-process Python mocks, in-memory replicas, production (read-only) or are blocked. An autonomous extension mirrors a service's Twine production spec, isolates it via application-level RPC filtering plus an LD_PRELOAD layer intercepting libc connect/sendto/sendmsg, and routes unknown RPCs to a universal mock, letting one-third of services run safely with no human setup. Thrift's reflective IDL lets it auto-generate fuzz harnesses and dependency mocks, and mutating sanitized recorded production requests helps fuzzing reach deep code paths past input validation.
- Mobile Developer Experience at Slack
Slack Engineering mediumAdeptA dedicated mobile Developer Experience team grew from 3 to 8 engineers and cut CI feedback time and failure rates by targeting the pain points that surveys, NPS and metrics like time to merge showed hurt developers most. iOS test time fell from about 50 minutes to an average of 9 by moving from Xcodebuild to Bazel with disk caching and bazel-diff, so only affected targets are tested. On Android, test sharding (in-house Fuel, later Flank) cut runs from 50+ minutes to under 20, and replacing Calabash with Espresso took suites from ~350 to ~60 minutes. Further gains came from auto-suppressing flaky tests (failure rate 57% to 4%), migrating from Jenkins to Buildkite (CI stability ~87% to 95%, TTM down 41%), generating Xcode projects with Xcodegen to avoid merge conflicts, and adopting a merge queue.
- Lastmile CLI: using a CLI to supercharge exploratory testing
Lyft Engineering easyNoviceLyft Bikes and Scooters' approach to end-to-end exploratory testing of hardware-dependent flows went through four stages. First came a physical "station in a box" tied to production. Then a station simulator that was too complex to set up, then one-off Python CLIs that faked legacy webhooks but required knowing internal implementation details and hand-typing IDs and coordinates. The team finally built lastmile-cli on top of Lyft's interactive TypeScript lyft-dev-cli. It runs locally, polls ride state and offers only valid next actions, and auto-gathers test data like no-parking-zone coordinates. The takeaway is that investing in tooling that simplifies getting systems into a testable state often pays off more than automating end-to-end tests, and here it also let PMs and designers test in staging.