You are on page 1of 6

This article is provided courtesy of STQE, the software testing and quality engineering magazine.

Tools & Automation

Orthogonally

Speaking
A method for deriving a suitable set of test cases
by Elfriede Dustin

I t’s a laudable goal: to conduct a thoroughly exhaustive


test of a system. In the real world, however, it’s general-
ly not possible, feasible, or cost effective to test a sys-
tem using all the possible variations and combinations of
test parameter inputs.
I was reminded of this recently while testing a tax management system. This
system contained a calculation engine that computed the depreciation of fixed as-
sets (e.g., computers, airplanes, office furniture) based on user-supplied informa-
tion about the assets of the company. These types of computations are complex,
and sensitive to different combinations of a large number of possible input para-
meters. Some of these parameters are the “placed in service date” of the fixed as-
set, methods of depreciation, life of the asset, business use percentages, fixed as-
set costs, and calendar years—only a few of many possible parameters. Each
parameter could have numerous values. As a result, there were tens of thousands
of potential input variations, each producing different results, and making exhaus-
tive testing of the calculation engine’s computations nearly impossible.
Our test engineers selected test input parameters that were based on high-risk
calculations provided by an accountant “subject matter expert” or on issues expe-
rienced in the past. Under this approach, the testers could never really measure
the completeness and coverage of their test suite. This manual testing process was
mind numbing and error prone.
Worse, the software engineers
QUICK LOOK
were wary of making any major
■ Determining test parameters when changes to the calculation engine;
they were afraid that any major
exhaustive testing is not practical source code change could result in
■ Ways to automate an orthogonal incorrect computations, compro-
mising the accuracy of the output
test array of the asset management system.
■ 5 mistakes to avoid There was no efficient way to
test any calculation engine source
46
www.stqemagazine.com STQE September/October 2001
This article is provided courtesy of STQE, the software testing and quality engineering magazine.

code changes; too many of the vari- in many modern areas of engineering. ues of all three parameters (a fault,
ables depended on each other. The OATS technique supports the for example, that would occur only
So how do you derive a suitable system test effort by enabling test cas- for the case A=1, B=1, C=1). But, be-
set of test cases when it’s just not fea- es to be determined efficiently and cause of the way programming works,
sible to use all the possible combina- uniformly. With this test technique it’s probably more likely that a fault
tions and variations of test parame- you’ll be able to select the combina- will depend on the values of only two
ters? This article addresses one tions of test parameters that will pro- of the parameters. In that case, the
solution: the test technique called the vide maximum coverage from test fault might occur for each of these
Orthogonal Array Testing System procedures, while using a minimum three test cases: A=1, B=1, C=1, A=1,
(OATS). Based upon my experience, number of test cases. The assumption B=1, C=2, and A=1, B=1, C=3. Since the
this technique is very useful for find- here is that tests that maximize the value of C in this example seems to be
ing a small set of tests (from a large interactions between parameters irrelevant to the occurrence of this
number of possibilities) that exercises will find more faults. particular fault, any one of the three
key combinations. The technique works. In our tests will suffice.
case, for example, OATS made it pos- Given that assumption, the array
sible for my team’s tax management in Table 1 shows the nine test cases
The OATS Solution developers to change their applica- required to catch all such faults, in the
OATS is derived from manufacturing tion’s calculation engine with more most economical arrangement that
techniques developed as part of the in- confidence. They fed automatically will show all possible pairs within all
dustrial engineering discipline. Orthog- generated OATS test parameters into three variables. The array is orthogo-
onal arrays (more on the term orthogo- a test harness, which in return exer- nal because, for each pair of parame-
nal in a moment) are used as a cised the calculation engine. The en- ters, all combinations of their values
mathematical tool in the Robust De- gine’s outputs were captured and be- occur once. That is, all possible pair-
sign methodology described in Madhan came the baseline for any future wise combinations between parame-
Phadke’s Quality Engineering Using changes to the calculation engine. ters A and B, B and C, and C and A are
Robust Design and other books. The This test harness has proven to be shown. Since we’re thinking in terms
Robust Design methodology, created very valuable, as it has uncovered of pairs, we say this array has a
by Professor Genichi Taguchi, is in use many calculation differences caused strength of 2. It doesn’t have a
by calculation engine source code strength of 3 because not all three-
changes. Moreover, the OATS proce- way combinations occur; A=1, B=2,
A B C dure has given us an objective mea- C=3, for example, doesn’t appear. But
1 1 1 3 sure of testing completeness. it covers the pairwise possibilities,
which is what we’re concerned about.
2 1 2 2
What Is an
3 1 3 1
Orthogonal Array? Applying the Technique
4 2 1 2 We’ll introduce the idea of orthogonal Before implementing orthogonal ar-
5 2 2 1 arrays with an example. Suppose ray testing, the test engineer needs to
there are three parameters (A, B, and determine the size of the array re-
6 2 3 3
C), each of which has one of three quired for the specific system test ef-
7 3 1 1 possible values (1, 2, or 3). The effort fort. The size of the orthogonal array
to test all possible combinations in- is based upon the maximum number
8 3 2 3
volving the three parameters would of values for all possible parameters.
9 3 3 2 require twenty-seven test cases. For demonstration purposes, let’s
Do you need all twenty-seven of look at a simplified example of how
those tests? Yes, if you think there’s a we might use OATS to test our fa-
TABLE 1 Sample array fault that depends on the precise val- vorite tech bookstore’s applications.
Table 2 shows example
parameters we believe might
CREDIT CARD
TYPE OF CREDIT CARD E X P I R AT I O N D AT E PRODUCT TYPE QUANTITY interact. They are: Type of
CREDIT CARD NUMBER ( Y E A R S F R O M T O D AY ) PURCHASED PURCHASED Credit Card, Credit Card
Number, Credit Card Expi-
Amex Correct 50 Book 1
ration Date, Product Type
Discover Incorrect Length Invalid Year Video 0 Purchased, and Quantity
Visa Invalid Digits Today Software –1 Purchased.
Each parameter has its
MasterCard Yesterday Book, Software, Videos 10 own possible values that
Invalid Character Book, Software 1 need to be tested in combi-
nation with the values of oth-
er parameters. The possible
TABLE 2 Bookstore purchase parameters and values values pertaining to the
47
September/October 2001 STQE www.stqemagazine.com
This article is provided courtesy of STQE, the software testing and quality engineering magazine.

ID CREDIT CARD CREDIT CARD NUMBER E X P I R AT I O N D AT E PRODUCT QUANTITY

0 Amex 402901517 2/13/2001 Books 1


1 Amex 123456789 2/15/2001 Software 0
2 Amex 11111111% 5/15/2001 Videos –1
3 Amex WER11212p 5/28/2050 Books, Software, Videos 10
4 Amex 542212345 3/16/2001 Books, Software 1
5 Discover 402901517 2/15/2001 Videos 10
6 Discover 123456789 5/15/2001 Books, Software, Videos 1
7 Discover 11111111% 5/28/2050 Books, Software 1
8 Discover WER11212p 3/10/2001 Book 0
9 Discover 542212345 2/13/2001 Software –1
10 Visa 402901517 5/15/2001 Books, Software 0
11 Visa 123456789 5/28/2050 Books –1
12 Visa 11111111% 2/22/2001 Software 10
13 Visa WER11212p 2/13/2001 Videos 1
14 Visa 542212345 2/15/2001 Books, Software, Videos 1
15 MasterCard 402901517 5/28/2050 Software 1
16 MasterCard 123456789 3/08/2001 Videos 1
17 MasterCard 11111111% 2/13/2001 Books, Software, Videos 0
18 MasterCard WER11212p 2/15/2001 Books, Software –1
19 MasterCard 542212345 5/15/2001 Books 10
20 Visa 402901517 3/26/2001 Books, Software, Videos –1
21 Visa 123456789 2/13/2001 Books, Software 10
22 Visa 11111111% 2/15/2001 Books 1
23 Visa WER11212p 5/15/2001 Software 1
24 Visa 542212345 5/28/2050 Videos 0

cide how parameters are likely to in- of 402901517, with an expiration date
TABLE 3 Test case definitions
teract. If only pairwise interactions are of 2/13/2001, involving the purchase
likely, the array should have a strength of one (1) book. [Author’s note: The
Type of Credit Card used by a cus- of 2. In this case, it seems reasonable credit card numbers used here and in
tomer might include American Ex- to say that pairwise testing is suffi- the accompanying table are truncated
press, Discover, Visa, and Master- cient (“good enough”) for this type of fictional numbers, so as to avoid any
Card. The Credit Card Number application testing, so three-way test- similarity to actual accounts.] Collec-
entries could be correct or incorrect. ing doesn’t seem necessary. (Note that tively, twenty-five test cases exercise all
All correct numbers are assumed to with a higher risk application, one pairwise combinations. Exhaustive
interact in the same way; that is, if might want to consider selecting an testing would have required 5 5, or
one correct number reveals a fault array that allows for three-way or n- 3125 test cases.
when combined with a Discover card, way input parameter testing.) You’ll see that the test cases con-
all correct numbers will reveal the An orthogonal array tool can be tain specific values, rather than mark-
same fault when combined with a Dis- used to produce an orthogonal array ers like “incorrect length” or “invalid
cover card. However, incorrect num- such as the one in Table 3. Each result- year.” To construct this example, we
bers are assumed to interact different- ing row in the orthogonal array speci- used a script that replaced the respec-
ly, depending on whether they have an fies one specific test case (without ex- tive values of the orthogonal array
incorrect length or some invalid dig- pected results). For example, in row with the actual parameters and values
its. number 0, a test case will be executed needed for the project.
Once the parameters and the val- using American Express as the credit Note that while OATS is a useful
ues have been derived, we have to de- card, with a credit card number value tool, you should consider using addi-
48
www.stqemagazine.com STQE September/October 2001
This article is provided courtesy of STQE, the software testing and quality engineering magazine.

tional testing techniques to derive allow for invalid input combinations. taught us several lessons on using the
your data elements when you’re deter- But choose carefully: if you throw technique effectively. The things we
mining actual values. Techniques such out the invalid cases, you might also did wrong in that first situation are
as boundary value analysis (e.g., se- be throwing out other combinations. mistakes you could easily make on
lecting the maximum, minimum, one For example, the A=1, C=1 case might your own; let’s look at each in turn.
more than maximum, one more than be the only row containing A=1, B=3
minimum, or zero data) in combina- (a valid combination that won’t be 1. Applying OATS manually
tion with OATS can be a powerful tested if you throw out the row). And We applied OATS manually during our
technique. (It is common for errors to if you throw out the invalid cases, first orthogonal testing effort. We de-
congregate around the boundary val- you won’t know how the system be- termined the variously sized orthogo-
ues.) In this example, one could pick haves given these invalid combina- nal arrays based on our test parame-
the Quantity 100,000—because tions. ters, and then manually replaced and
that’s the maximum number of any In the case study I mentioned plugged in the actual values into the
item that can be purchased at one time earlier, in which we used orthogonal table, using an Excel spreadsheet. Do-
in this example—then try 99,999 (one array testing for the calculation en- ing all this manually was very time
less than maximum), 100,001 (one gine of the asset management sys- consuming, tedious, and prone to in-
more than maximum), etc. tem, we decided to also allow input accuracies—and it required quite a bit
This example also illustrates an of invalid test combinations. The cal- of maintenance. We didn’t have the
issue that often arises: unspecified culation engine was expected to pro- extra budget to buy commercial test
values. Because there are fewer Type duce consistent results among the case generating tools, but had we
of Credit Card and Credit Card various builds, whether the input was known then about the availability of
Number values than there are Expi- valid or invalid. orthogonal array freeware, we could
ration Date values, not all rows in Please note that Table 4 is a sim- have used it to automatically generate
the orthogonal array are required to plified excerpt, one that is small and various array sizes. These automati-
exercise all the pairwise combinations readable, of a sample test case com- cally generated arrays could have
involving them. For some of the rows, bination. In addition to the parame- been used in turn to write a program
the value of Type of Credit Card or ters illustrated here, the bookstore that automatically replaced the num-
Credit Card Number is left to the might also wish to track the number bers in the table with actual test para-
discretion of the test engineer. The of books that remain in inventory fol- meter values.
values can be chosen based on risk, lowing the purchase, or be able to
highest usage, or highest problem query the purchase status for a par- 2. Focusing the testing
area. Table 4 gives an example. Amer- ticular customer. Test professionals effort on the wrong area
ican Express might have been chosen should review the resulting test cases of the application
because it has been the card the book- and add additional test cases based Some readers might be enthusiastic
store’s application traditionally has on known risk areas. about implementing orthogonal array
had the most trouble with, or is used In our test program for the asset testing in their next testing project.
most often. A correct Credit Card management calculation engine, we While you’re exploring those possibil-
Number might have been chosen be- executed a test harness that generat- ities, temper that eagerness with a
cause incorrect number input might ed over 17,000 test cases using sense of perspective. Just because a
not have been an issue in the past. OATS. A software program was then specific area of the application lends
In some cases combinations of developed that incorporated these itself perfectly to orthogonal array
test parameters and values can be in- test cases and applied them to the testing, don’t get distracted and shift
valid, and an invalid test case combi- back end of the Web application one the whole focus of the testing effort to
nation is generated (depending on by one. (Such a software program that area. As with any testing tech-
business logic). For example, with might be tailored to create a particu- nique, it’s important to focus this
three parameters (A, B, and C), it lar load on the system, or to simply method on the critical areas. You have
might be invalid for both A and C to verify baseline functionality.) to evaluate whether it’s feasible to ap-
have a value of 1, but the OATS tool ply OATS testing to a specific area.
would still generate that combina- For example, one test engineer I
tion. In that case it is up to the test Mistakes to Avoid know returned from a training class on
engineer to make a decision. You can Although we’ve used OATS success- the OATS technique, impatient to apply
execute the test case as is (garbage fully on a variety of projects, we had a it right away. He spent days devising an
in and garbage out) and determine false start on a previous project that incredibly elaborate orthogonal array
how the system handles in-
valid combinations of input.
CREDIT CARD
Or you can decide to not TYPE OF CREDIT CARD E X P I R AT I O N D AT E PRODUCT TYPE QUANTITY
use the invalid test case CREDIT CARD NUMBER ( Y E A R S F R O M T O D AY ) PURCHASED PURCHASED
combinations—in order to Amex Correct Invalid Character Books, Software 1
shorten the test case evalua-
tion cycle, or in cases where
the back-end system doesn’t TABLE 4 Sample combination
49
September/October 2001 STQE www.stqemagazine.com
This article is provided courtesy of STQE, the software testing and quality engineering magazine.

testing system to verify possible query 3. Using OATS for minimal 5. Picking the wrong
combinations applied through a GUI. testing efforts parameters to combine
This specific application used a GUI In some cases OATS might ask for When I’m teaching the OATS testing
front end that allowed the user to se- more test cases than is necessary for a technique, I often ask my audience
lect various query combinations by se- “good enough” testing effort or for the members to come up with an example
lecting parameters on various pull- testing time and budget allotted. Here application on which they think they
down menus—basically an in-house again, it’s important to evaluate could apply OATS. I then ask for vol-
modification of a commercial off-the- whether the OATS testing technique is unteers to present their example ap-
shelf (or COTS) system that allowed appropriate, or whether other testing plication and how they would specifi-
for various application queries. The techniques such as boundary values, cally apply OATS. The most common
COTS tool had already been tested equivalence classes, etc., would be issue that surfaces during this exer-
thoroughly by the vendor, but in his ea- sufficient. If the test engineer decides cise is that people pick the wrong pa-
gerness to apply his newly learned to go forward with the implementation rameters to combine.
technique the test engineer lost sight of orthogonal array testing despite Picking those parameters can be
of the big picture. He applied his elab- timing or budget concerns, it’s impor- an elaborate effort—especially when a
orate OATS scheme to the wrong area tant to evaluate the OATS-generated wide variety or huge number of para-
of the system: the already-tested COTS test case combinations and omit any meter combinations is involved. In the
front end. It would have been good excessive test input combinations. case study of the calculation engine,
enough to simply run a variety of GUI our search for the right parameters
tests to verify that the pull-down selec- 4. Using OATS for high-risk to combine meant doing a detailed
tions worked and produced correct re- applications analysis, in which we enlisted the help
sults. In this case using an elaborate If you are testing medical device sys- of a subject matter expert, a develop-
OATS system was excessive, and the tems or any other life-critical applica- er who understood the calculation en-
testing effort would have been better tions, don’t pin your hopes on orthog- gine code, and a test engineer.
focused on verifying the accuracy of onal array testing to do the job all by
the SQL queries (the actual code) and itself. You’ll need to complement this
on verifying the data migration. testing technique with other well-es- Summary
The OATS testing method is a tablished testing techniques. It’s im- Exhaustive testing in most cases is
great resource, but it’s important to portant to keep in mind that the goal not possible, feasible, or cost effec-
evaluate where in your application of OATS is to allow for minimizing the tive. The effort to include all possible
testing effort it will be most effective test combination inputs—it’s not a combinations and variations of test
and efficient to apply, and how much technique that allows for exhaustive input parameters is generally an im-
of it to use. testing. possible undertaking for complex

PERSPECTIVE

Test Coverage without a way to demonstrate thorough test coverage in a short time peri-
od.”
Missing a Beat Based on advice from the original engineers, Campbell’s
team quickly targeted key functionalities and laid out an efficient

W arren Campbell knows the importance of making your en-


trance on time. He was, after all, a professional opera singer
testing array. “Things came together,” he says. “We didn’t neces-
sarily reduce the total amount of testing, but OATS helped cut
before switching from on-stage vocalizing to developing voice-in- down on the complexity of the testing.” They weighted the array
teractive systems for DECvoice platforms. So when he was as- according to risk and core functionalities—and got their testing
signed to work on a pharmaceutical application two years ago done two weeks ahead of schedule. “The alternative to using this
with a crucial product rollout date, he took the schedule con- method would have been chaos and major delays,” says Campbell.
straints seriously. “Instead, we had coverage that would stand up to a tough regula-
The problem was that testing the product to meet exacting tory inspection, and had it early!”
regulatory standards was going to be impossible in the time allot- Although Campbell has seen his share of projects over the
ted. Fortunately, he recalls, two things were working in his team’s years that couldn’t really take advantage of an OATS approach—
favor. First, there were still developers around who had designed because of a lack of traceability, change management, thorough
the original legacy portion of the software, and second, Campbell design processes, or clear communication—his success on that
had been reading up on orthogonal array testing and was eager to first orthogonal project made him a believer in the approach, and,
try it. “Verification and validation standards for pharmaceutical he says, has been key to several of his projects staying
projects are incredibly rigorous,” he says, “and OATS seemed to be on pitch. —A.W.
50
www.stqemagazine.com STQE September/October 2001
This article is provided courtesy of STQE, the software testing and quality engineering magazine.

systems, and an attempt to do so can the OATS technique can be a very published book Quality Web Systems.
result in scope creep. One common useful method for deriving a suitable Her Automated Software Testing
practice in situations such as these is set of test cases. STQE white papers are posted on www.
to guess, using engineering judg- stickyminds.com.
ment, on which test parameters to Elfriede Dustin (edustin@bna.com)
choose. Shooting in the dark like that works as a QA/Test Manager at
can yield hit-and-miss results—and BNA Software (www.bnasoftware.
STQE magazine is produced by
that’s just not very effective. When com). Elfriede is co-author of the STQE Publishing, a division of Software
your testing effort faces an impossi- book Automated Software Testing, Quality Engineering.
bly wide choice of test parameters, and also co-authored the recently

51
September/October 2001 STQE www.stqemagazine.com

You might also like