TDD and BDD at National Mortgage Institute | Cprime








Case Study

Test-Driven Development at National MI

100%Story Acceptance Rate
92%Test Coverage (Significantly Higher than Industry Standard)
10 Hours of Technical Debt

Company Details

Industry: Financial Services

Company Size: 250 Employees

Location: CA, US

Cprime Services:

Executive Summary

The turbulent environment in the mortgage industry continues to challenge mortgage lenders and servicers alike. Complex, inflexible and costly-to-maintain legacy systems struggle to keep up with the frantic pace of changing regulations, technology advancements, investor guidelines and customer expectations. With the help of Cprime Agile consultants and development trainers, the company improved their test coverage and story acceptance rate significantly.


National Mortgage Insurance (National MI) is a private mortgage insurance company that enables borrowers with low down payments to realize homeownership, while protecting lenders and investors against losses related to borrower default. National MI moves MI forward to support the needs of an evolving mortgage industry.

The turbulent environment in the mortgage industry continues to challenge mortgage lenders and servicers alike. Complex, inflexible and costly-to-maintain legacy systems struggle to keep up with the frantic pace of changing regulations, technology advancements, investor guidelines and customer expectations.

The Challenge

Enabling Faster Delivery of Applications

National MI considered test and behavioral driven development to enable faster delivery of applications, while ensuring a high degree of quality. Test driven development (TDD) provides a path to build automated tests, thereby providing high test coverage. Behavioral tests capture end-user scenarios and help to build realistic end-to-end tests.

TDD is based on a simple idea: write a failing test before you write production code itself. It is an established technique for delivering better software faster and in a sustainable manner over time.

National MI started exploring the idea of implementing TDD when they launched a new project. The organization was looking to upgrade an in-house platform for mortgage insurance solutions. They were using a collection of different web applications and needed to build out this new additional piece at a rapid pace to meet customer demands. National MI understood they needed to adopt agile technical practices from the outset. This new application was a customer-facing, business critical component that required modernizing the traditional look and feel as well as offering new features with a rich UX and that was also mobile-enabled.

The Plan

Slow and Steady Wins the Race

Although National MI had been using Agile in their organization for a few years already, they had never implemented TDD and were excited to explore that methodology. The team started with organic adoption of test and behavior driven development as they explored the proof of concept and stepped up the effort with training and experimentation, which led to early success.

Initially, the project was launched as a proof of concept with a team consisting of:

  • 1 Scrum Master
  • 1 Developer
  • 1 QA
  • 1 Project Lead

Their initial feedback was to confirm that these techniques were very helpful to ensure high test coverage that allowed them to build cleaner interfaces.

Following these early successes, the PoC team decided to recommend and encourage broader adoption. They held a demo of the proof-of-concept and reviewed their conclusions with the larger development team. The team adopted TDD from the first sprint of the new project. Business analysts adopted BDD and started writing acceptance tests starting from the third sprint.

National MI engaged Cprime based on their proven expertise in agile development and consulting. Initially, the project started with Cprime providing expert trainers to train the developers on TDD. The initial positive impact of the TDD approach was such that soon enough, the BA’s learned of this success and expressed strong interest to adopt it themselves. National MI engaged Cprime to provide training to the Business Analysts. The training covered acceptance test writing, including suitable business test cases and test data as well as the process by which they are approved by business stakeholders.

The National MI team was very pleased with the Cprime training. They felt that the Cprime team showed a carefully balanced mix of technology and business expertise, which enabled them to blend, impart knowledge and get along well with the team.

The Results

Reducing Defect Rates Significantly

When National MI launched the TDD project, the teams expected potential delays. As they were adopting and implementing this methodology for the first time, Cprime experts supported the process and helped minimize the adverse effect on timelines and deliverables. Despite an initial learning curve, the team reported significant reductions in defect rates. The moderate cost increase in initial development effort was more than offset by a reduction in the timelines of the project’s later phases. Management understood the clear value generated by this effort and supported the team’s commitment to the practices. TDD also yielded a more sustainable codebase over the course of time that led to easier rollout of new enhancements as well as refactoring when needed.

This new way of working at National MI has strengthened the teamwork across the BA, Dev, QA, Product Managers, and UAT team members. National MI also achieved tangible improved time to market due to reduced time and effort needed to enhance the product.

With the continued success of this project, the team was keen to broaden the adoption and apply it to its core platform as well as to other applications within the organization.

Some of the Benefits: 

  • Achieved a code maintainability rating of A (highest rating achievable)
  • After 6 releases, technical debt dropped to 10 hours (based on the team’s past performance, their technical debt at this point would be measured in hundreds of hours)
  • Code quality increased dramatically
  • Test coverage of 92% (significantly high compared to industry standard)
  • % defects/KLOC: 0.2 (11/6000) – 0.2 ratio of defect per 1000 lines of code-a ratio of 1 is considered significant, so this was an exceptional improvement
  • Story acceptance rate is now 100% with timely acceptance – what previously took a week to complete was now achieved in a couple of days
  • TDD enabled the teams to write both module and integration tests
  • Integration with other pieces of the platform was improved
  • Responsiveness overall increased significantly
  • Due to the higher engagement of the business stakeholders, better match of expectations between business and IT

TDD encouraged improved collaboration between different stakeholders, while increasing automation, as well as the timeliness and quality of feedback. Overall, TDD allowed the National MI team to develop in a more consistent and predictable cadence, reduce time to market, adapt their software to the ever-changing business needs and ultimately – delight their users.

Cprime, as a trusted partner, was an integral part of the implementation. Cprime’s experts worked shoulder-to-shoulder with National MI management and practitioners to facilitate the successful adoption of these new sets of practices and processes, imparting knowledge and expertise to reduce potential friction and ensure that the tremendous potential benefits of TDD were achieved.


Interested in similar results for your organization? Explore our flexible Agile training and Agile coaching solutions.


About Cprime

Cprime is an industry-leading, full-service global consulting firm with a focus on providing integrated and innovative solutions around digital transformation, product, cloud, and technology. With over 20 years’ experience, we provide strategic and technical expertise to businesses across more than 50 industries. Our team of advisors and technical experts have the know-how to meet organizations where they are to develop actionable solutions and solve business challenges. We also collaborate with our expansive network of partners to design, deploy, and harmonize technology stacks across organizations. Our mission is to empower visionary business leaders and teams to reimagine the future of work to achieve better outcomes.

Want to share with a colleague? Download the PDF

Let's Talk!