Automated Unit Tests for Legacy Code with Pex

Generation Test: Automated Unit Tests for Legacy Code with Pex

Automated Unit Tests for Legacy Code with Pex
Nikhil Sachdeva

Download the Code Sample

In my previous life I was a consultant. One of my clients, a leading bank, wanted to automate its loan origination process. The bank already had a system in place that included a Windows-based application, a proprietary back end and a mainframe system that was also the heart of their solution. My job was to integrate the existing systems with a set of applications being developed for the accounts division.

The client had built a Web service that communicated with the mainframe. At first it seemed pretty simple. All I had to do was to hook into the service, get the information and pass it to the new accounts application. But it’s never that simple.

During implementation I found that the new systems expected a Loan Originator attribute, but the Web service GetLoanDetails method did not return that information. It turns out that the service was created years ago by a developer who’s no longer with the company. The bank has been using the service without any modifications because it has many layers and everyone is afraid of breaking something.

That Web service is legacy code.

Eventually, we built a lightweight service wrapper so the new systems could call it for any new information and continue using the old service as well. It would have been much easier to modify the existing service if a consistent and testable design had been followed.

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

What is 4 + 5 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)