Guest Author - Julie L Baumler
Soap Opera Testing is a type of scenario based test where you pack the most extreme examples of realistic events into a short time period, as is done in the plot of a soap opera (or almost any day when you live with teenagers.) The origin of Soap Opera Testing is an eponymous article by Hans Buwalda published in the February 2004 issue of Better Software. They can be a very efficient way to test a lot of edge cases quickly. My experience is that the first time I used a Soap Opera test, I covered most of my negative test requirements without even trying, as well as a number of other important features. Additionally, writing Soap Opera Tests allow you to be creative in a different way than is usually needed in testing or computing jobs, which makes for a nice change of pace.
Here is an example Soap Opera Test for an Automatic Teller Machine:
Chris and Chas Niemand are sister and brother who live together in a house they inherited from their parents. Chris is a computer technician, on vacation this week, who has a second job as an on-call ATM tech. Lucky for Chrisís pocket book, they live close to a particularly troublesome (and therefore little used) ATM. Chas works from home as a writer. They have a joint checking account to cover household expenses which is linked to each of their ATM cards. Chris' card is also linked to her savings account. Charles' card is also linked to his money market account.
At 11pm Chris is called out to a malfunctioning ATM, luckily it is the one closest to her house. She arrives and discovers that it is turned off and appears to have been accidentally unplugged. She plugs it in and turns it on. She doesnít have access to refill the cash in the ATMís so she checks the current contents of the ATM $580 and enters 29 as the number of $20 bills in the ATM. To test that the ATM is fully working, she decides to take out $20 so she can stop at the store on the way home, since she and her brother are almost out of milk and coffee. When the machine asks her for the withdrawal amount, she accidentally presses the off button (she hasnít shut the machine as she may still do more work on it.) Luckily, nothing happens because she is in the middle of a transaction. She successfully takes out the $20 and ejects her card and receipt. She notices that the checking balance is only $80. Apparently her brother still hasnít put his share for the month into the joint account. She locks the machine and then starts another transaction to transfer $100 from her savings to the joint checking account to make sure that they have enough money for household expenses. She is done by 11:45.
The next morning at breakfast Chris mentions to her brother that heís late transferring funds into the joint checking account. He tells her that he has several checks that should be in todayís mail and heíll be sure to deposit them and transfer funds into the joint account when the mail arrives. He reminds her that the lawn guy is coming that morning instead of the next day as scheduled. She heads over to the ATM to get money to pay him. On the way she stops and picks up her $200 paycheck for last weeksí on-call work. She deposits the $200 in checking and takes $100 out of checking. At the coffee shop that afternoon, she sees a flyer for someone selling exactly the lawn furniture sheís been looking for. After calling them, she bargains them down to $200. She heads to the ATM, attempts to take $200 out of checking, but it fails because her brother hasnít made his transfer yet and the check she deposited is not yet part of funds available. She takes $200 out of her savings account. She gets home with the new-to-her lawn furniture and discovers that the mail has arrived but her brother hasnít done anything about it. She sends him to deposit his paychecks.
Charles heads to the ATM. The first time he tries to enter his pin, he presses return before entering anything and is unsuccessful, the second time he enters extra numbers. The third time he correctly enters the correct pin. He has a deposit of 4 checks totaling $3400 dollars to put into his Money Market Account, however the first time he enters $4300, notices what he did when he did and presses cancel before hitting enter. The second time he enters $34000, notices after the machine asks him to insert the envelope and presses cancel. The third time he gets the entry amount of $4300 right, but is distracted from inserting the envelope by his cell phone and they ATM times out. Finally the fourth time is the charm and he successfully makes his deposit. He transfers $2000 from his Money Market account to the joint checking account. Finally, he decides to make a withdrawal from his Money Market account. In his usual bumbling manner, he accidentally tries to withdraw $0, which fails because it is an invalid amount. Then he withdraws $200. He tries to withdraw another $200, which fails because it is over the daily limit. Third time he successfully enters $100, but it fails because the ATM doesnít have that much money. He finally successfully withdraws $80.
Later, Chris goes over to the ATM, planning to transfer $300 from checking into her savings account to make up for the funds sheíd used that should have come from the joint account. She pulls the ATM card out of her jacket pocket and enters her pin. It doesnít work, so she figures that she typo-ed it and enters it a second and third time. It is still wrong and the ATM takes the card. She remembers that her brother wore her jacket earlier and after checking her pockets finds her card and realizes that she had accidentally used his. She enters her card with the correct pin and successfully transfers the $300. She checks balances on both her accounts. She has a duplicate of her brothers card in her wallet and tries to use it to make sure she was correct in her supposition. As expected, it fails because the card was previously retained.
At this moment, Chris receives a phone call and is asked to pull the logs and turn off the ATM, because it is out of money. She is to wait for the armored car, which is on itís way, because there have been inconsistencies with this ATM after refills in the past. When the armoured car drivers open the ATM and turn it on, they donít ground themselves before brushing against the electronics next to the refill tray and there is a small static discharge. They put in 50 $20 bills. When Chris uses her card and the duplicate of her brotherís to check balances, all the balances are set back as if the last 24 hours of transactions had not occurred.
Hans Buwalda. "Soap Opera Testing." Better Software. February 2004. pp. 30-37.