Skip to content
All projects

API and contract test automation in an online banking microservices program

Project write-up

The client is described by industry and scale, without a name. KPI figures are targets agreed with the client after a baseline measurement.

In brief

Problem
Teams deploy independently, but integration tests run on a shared environment once per release.
Approach
We introduce consumer-driven contract tests (Pact) with a contract broker, which block the deployment of a service that breaks a contract.
Goal
Lead time from change approval to production (DORA metrics): < 1 day; Share of deployments causing an incident (change failure rate): < 15%.

Client context

The Polish banking sector is highly digitized and at the same time operates under strict supervision by the KNF (Polish Financial Supervision Authority). Every change to a system used by customers must go through change control, testing and an acceptance process that can be shown to an auditor. The client is a bank in the middle of moving from an online banking monolith to several dozen microservices developed by independent teams.

Challenge

Teams deploy independently, but integration tests run on a shared environment once per release. A contract change by one team can block several others for days.

Requirements and constraints

  • Recommendation D of the KNF (Polish Financial Supervision Authority) sets out the supervisor's expectations for managing information technology and the security of the ICT environment in banks: separation of environments, change control, access management and business continuity. Every change in the system must go through a test and acceptance path that can be shown to an auditor. (source)
  • DORA, the Digital Operational Resilience Act (Regulation (EU) 2022/2554), requires ICT risk management, a register of contracts with ICT providers, classification and reporting of major incidents, and regular testing of operational resilience. For the project this means every new component needs an owner, a dependency map and a resilience test scenario, and the provider (including us) goes into the register of information on contractual arrangements. (source)
  • Project constraints: work only on anonymized or synthetic data outside production, access to systems through the client's infrastructure, every deliverable handed over with documentation the client's team can take over.

Approach and architecture

We build automation following the test pyramid: the most tests at the unit and API level, fewer at the UI level, and end-to-end scenarios only for critical business paths. The framework is built as a product (with code reviews, versioning and documentation) and runs in the CI pipeline from the first sprint, so the development team gets feedback in minutes, not after a week.

We introduce consumer-driven contract tests (Pact) with a contract broker, which block the deployment of a service that breaks a contract. Each service's API tests run in isolation against stubs, and the shared environment is used only for a small set of end-to-end tests.

Key elements of the solution:

  • Contract broker with verification in the pipeline (can-i-deploy)
  • Component tests with Testcontainers
  • Stubs generated from contracts
  • A small E2E suite for critical paths

Team and roles

RoleCountResponsibility
QA lead1organizing the testers' work, case reviews, defect metrics
Test automation engineer3framework, scripts, CI integration
DevOps engineer1CI/CD pipeline, infrastructure as code
Product owner and domain experts (client side)as neededpriorities, business decisions, acceptance

Phased schedule

PhaseWeeksDeliverable
1. Regression audit and candidate selection1–2automation map, cost-benefit analysis
2. Framework build and CI integration3–6framework, pipeline, test code standard
3. Automation of critical paths7–13smoke and regression suites
4. Stabilization and reporting14–17quality dashboard, quarantine for flaky tests
5. Handover and team training18–20documentation, workshops, maintenance plan

Technology stack

Pact, Pact Broker, REST Assured, Testcontainers, JUnit 5, GitLab CI, WireMock.

Risks and how we mitigate them

RiskHow we mitigate it
Low user adoptionchampions in each department, training on their own cases, usage measured from day one
Flaky automated teststest quarantine, root cause analysis, stable selectors and independent data
Large number of integrations with unclear ownersintegration catalog with owners, contract tests, prioritization by criticality
Knowledge held by single individualspair programming, documentation in the repository, backup plan for key roles

Measurable goals and KPIs

The values below are targets that we set with the client after a baseline measurement in the first phase.

KPITargetHow it is measured
Lead time from change approval to production (DORA metrics)< 1 dayrepository and pipeline data
Share of deployments causing an incident (change failure rate)< 15%change and incident register
Share of flaky tests< 2%pipeline report (tests with inconsistent results)
Full regression timefrom days to hours, target ≤ 8 hsuite execution time in CI

Lessons learned and good practices

Contract tests only work when they block deployment, because nobody reads optional reports. The hardest part is changing teams' habits, not the technology. A flaky test is worse than no test, because it undermines trust in the whole suite.

Why B2B.net

B2B.net S.A. has been operating since 2015 and has worked for more than 50 brands, mostly where audits are part of daily life: in banks, insurance and critical infrastructure. We are an accredited exam center, so testing methodology is not a claim for us but a working standard. We give a first proposal of engineers within 24 hours, and a team can start within 5 business days.

Acceptance criteria

Each phase ends with a formal acceptance against criteria agreed at the start. In this engagement, acceptance covers: the automation map and cost-benefit analysis; the framework, pipeline and test code standard; the smoke and regression suites; the quality dashboard and quarantine for flaky tests; documentation, workshops and the maintenance plan. Final acceptance requires a KPI measurement report against the baseline, complete documentation handed over to the client's team, and a list of recommendations for the next stage, with a cost and risk assessment for each.

Next step

Let's talk about your project. Within 24 hours we will get back to you with a quote or a proposal of engineers; a team can start within 5 business days. Contact: office@b2bnetwork.pl.

What would this look like for you?

Book a 30-minute call. We will prepare a plan for the first weeks and a team matched to your system.

Let's talk

B2Bnetwork · B2B.net S.A. · accredited exam center. We describe clients by industry and scale, without names.

More projects: Banking