Journey chapter
Writing the test before the service
A short chapter on insurance data services taught me test-driven development in a microservice system, and showed me what it takes to add a new service to a system that already works.
What changed
In mid-2020 I moved to a backend role at KMS Technology on a LexisNexis insurance project. It lasted only about eight months, but it changed how I work. The team was six people, and I worked as both a backend developer and the person setting up deployment for a new subsystem.
The subsystem’s job was to move base data to the downstream services that calculate insurance claims. It had to join an existing system of Java microservices without disturbing it. The team worked test-first, which was new to me.
The work that shaped this chapter
Reading the system before changing it
A microservice system does not come with one place to read. The data flow is spread across services, message streams, and configuration, and much of the behavior lives between them. Before building anything, I traced how data already moved through the existing services, what each one expected to receive, and what it promised to produce.
That reading turned into the first tests. Once I could state what a service should do with a given input, I could write that down before writing the code.
Test-driven development in Spring
We wrote tests first. For each feature, the test described the expected behavior, the code was written to pass it, and then the code was cleaned up with the tests as a safety net. Unit tests covered the logic inside a service. Integration tests ran a service against its real dependencies, so we learned early if an assumption about another service or the data was wrong.
The services were built with Spring MVC and Spring REST, and parts of the data movement ran on Spring Cloud Data Flow. The test-first rhythm felt slow at first. It stopped feeling slow the first time a refactor that touched several classes came back green and I could trust it.
Tests as the gate to deployment
I set up automated deployment for the new subsystem with Kubernetes, Helm charts, and GitLab Runner. The pipeline ran the tests before anything was deployed, and a failing test stopped the release. That turned the tests from a habit into a contract: nothing reached the cluster unless it had shown it still did what it promised.
My contribution within the team
I built backend features for the new subsystem test-first and set up its deployment, from Helm charts to the GitLab pipeline. Teammates owned the wider system and its existing services, and much of what I learned came from reading their code and working inside their conventions.
What was hard
The hard part was that correct in isolation did not mean correct in the system. A service can pass every unit test and still misread a field another service sends. Integration tests were slower and more work to set up, but they were where those mistakes showed up before production did.
The judgment I developed
- Write down what the service should do before deciding how.
- Test against real dependencies where the boundaries are, not only against mocks.
- Let the pipeline enforce the tests so quality does not depend on memory.
- Treat deployment configuration as code that is reviewed and tested like the rest.
Looking back
It was a short chapter, but what I kept from it was the discipline. When I work with coding agents today, the same idea applies: a clear, testable statement of the behavior comes before the code, whoever writes the code.
What this opened next
In early 2021 I joined a young design-tool startup. The work moved much closer to the interface, but I brought the backend habits with me: reading the system first, making contracts explicit, and not trusting a change until something has checked it.