Tinder, Transplants, Testing and Triangle

The connection between Tinder, life-saving kidney transplants and software testing is not immediately obvious.  If you can’t see it, don’t worry …. it took several decades and Nobel Prize winning contributions in Computer Science and Economics for all to become clear.

Stable (?) Marriage

Let’s start with the easy connection. In 1962 David Gale and Lloyd Shapley wrote a paper on what they termed the “Stable Marriage Problem” (or, more generally, the “Stable Matching Problem”).

I’ll pause for a moment while you make jokes about Tinder and “Stable Marriage”…..

The Stable Matching Problem is conventionally defined (in a very 1960’s way) as …

“Given n men and n women, where each person has ranked all members of the opposite sex in order of preference, marry the men and women together such that there are no two people of opposite sex who would both rather have each other than their current partners. When there are no such pairs of people, the set of marriages is deemed stable.”

The genius of Gale and Shapley was to abstract away from this to a more generalised problem and produce what became known as “deferred acceptance algorithm”, which, many years later, won Nobel prizes and saved lives.

What’s this got to do with testing?

Before we get there …. what’s this got to do with kidney transplants? It took nearly 30 years for that connection to become clear, so I think we can wait a bit longer for the connection to testing….

Kidney Transplants

If a patient is in need of a kidney transplant then frequently family members and loved ones are willing to offer one of their healthy kidneys for transplant. However, it is often the case that donor and patient are not compatible.

Doctors soon realised that they could increase the number of transplants by “matching” pairs of donors and patients. Patient P1 has a potential (but incompatible) donor D1, and patient P2 has a potential (but incompatible) donor D2. If P1 and D2 are compatible, and P2 and D1 are compatible then a simultaneous transplant can be performed and lives are saved.

Long story short … the Economist Alvin Roth adopted Gale and Shapley’s algorithm for, inter alia, the matching of kidney donors and recipients and founded the New England Program for Kidney Exchange.

More than 2000 patients have received kidneys as a result of the work of Gale, Shapley and Roth. Gale died in 2008, but in 2012 Shapley and Roth received the “Nobel Prize” for Economics for their work.

Testing as a Matching Problem

Consider the following common testing scenarios:

  1. A trade capture interface is being tested. New and old versions of the interface are running in two environment and we want to prove the “same” data is captured in both, although data might have arrived in different order in each environment.

  2. During user testing we want users to enter data in to new/old systems and we want to prove that the “same” information was captured in both. Predictably the user make mistakes, enter data in the “wrong” order, etc.

If only new/old environment captured data with a unique and shared identifier this problem would be easy. In practice this is often not the case and we have to somehow determine equivalence between data from two sources.

Trying to compare (match) two sets of data turns out to be hard, but thankfully we can make use of Nobel prize winning scientists.

Matching with Triangle

Trinitatum’s Test Automation framework Triangle provides support for just the sort of intelligent matching that is necessary to make sense of some misbehaving interface or inconsistent user. Presented with two data sets Triangle can figure out the best way of matching them.

As a tester you need have no understanding of the deferred acceptance algorithm; you can just say that you want to perform a intelligent match between two data sets and leave the hard work to Triangle.

Better than Tinder?

In terms of contributions to society …. the fact that Triangle uses a Gale/Shapley deferred acceptance algorithm for complex matching problems falls well short of the impact of life-saving kidney transplant operations.

We’re not expecting a Nobel Prize, but we’re solving real testing problems.

Whether it’s more significant than Tinder is left to the reader to decide.