Operations 8 min read

How a Bank’s DevOps Team Boosted Code Quality with Unit Testing and Automation

The article details how China Construction Bank's software development center enhanced code quality and accelerated delivery by integrating unit testing, test‑driven development, mutation testing, automated test code generation, code‑style scanning, and shared template mechanisms within a mature DevOps pipeline.

Efficient Ops
Efficient Ops
Efficient Ops
How a Bank’s DevOps Team Boosted Code Quality with Unit Testing and Automation

This article introduces how the China Construction Bank Software Development Center project team improved code quality for rapid development and deployment using unit testing, code scanning, mutation testing, and code‑assistant tools.

DevOps, the combination of Development and Operations, aims to increase a technology team's responsiveness to business needs.

When requirements are clear, the key to faster business response is shortening the time required for testing, version creation, and deployment. Since 2009, the center has built an automated toolchain, achieving noticeable efficiency gains in version production and deployment.

In the high‑speed highway analogy, the challenge is whether your code can safely travel at such speeds, making test efficiency a top priority.

1. Replace traditional unit testing with Unit Test Driven Development (UTDD)

Traditional unit testing is performed after code completion, often seen as extra work with little immediate benefit, leading to resistance and limited impact on code quality. UTDD advocates designing test cases before writing product code, forcing developers to consider code completeness and testability early.

Defining the "unit" is crucial; while the official definition targets the smallest testable component (often a method), designing test cases at this granularity can be cumbersome. Instead, the team designs UTDD cases based on system layers and modules, such as Spring's Controller/Service/Dao layers, creating a clear test case list for each scenario.

2. Implement pair review for unit test cases

To ensure completeness of test case design, the team introduced a pair‑review mechanism with functional testers. Developers submit their test case lists to testers, who verify business logic coverage and completeness, describing scenarios in business terms rather than low‑level method inputs.

3. Auto‑generate initial unit test code to reduce coding effort

Developers fill a unified Excel template with test scenarios, external dependencies, and English test case names. A simple macro then generates the initial unit test code, reducing manual coding and allowing developers to focus on test design quality.

4. Conduct mutation testing to ensure test completeness

Mutation testing modifies existing code (e.g., changing return values or logic) and runs the unit tests; if tests still pass, the test cases are insufficient. Results guide developers to refine and strengthen their test cases before code submission.

5. Enforce code style scanning and gate control

Beyond logical correctness, code style is enforced via a scanning tool and gate system. Developers receive real‑time feedback in their IDE, while the DevOps pipeline blocks code that fails style checks, coverage thresholds, or mutation testing criteria, providing hard control over code quality.

6. Establish a shared template code mechanism

To avoid propagating defects from reused code, the team uploads well‑structured template code to a code‑assistant platform. Developers can search for and import these templates directly in their IDE, ensuring new features start from high‑quality examples and improving development efficiency.

automationDevOpsUnit Testingcode qualitycode scanningMutation Testing
Efficient Ops
Written by

Efficient Ops

This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.