All Pages All Books|
|
||
|
This first script tests several ways to find a Corgi, a small herding dog. The stories tested by the script are:
• Organize catalog hierarchically by category, breed, and animal for sale.
• Allow buyers to search for animals by keyword(s). The test script in Perl syntax is:
test_setup(’PetShop’);
home_page(); follow_link(’Dogs’); follow_link(’Corgi’); add_to_cart(’Female Puppy Corgi’);
search_for(’corgi’); add_to_cart(’Female Puppy Corgi’); search_for(’CORGI’); add_to_cart(’Female Puppy Corgi’); search_for(’dogs wales’); add_to_cart(’Female Puppy Corgi’);
|
||
|
|
||
|
The first line in the script tells the test framework6 what we are test-ing. test setup establishes the functions, or actions, used by the test. Since this is an online store, the actions include: home page, follow link, search for, and add to cart.
Acceptance test scripts are similar to the script to a movie or play. The roles are the user and the computer. The script shows the user role, or what the user does and expects to see. For example, the second section of the script follows the site’s hierarchy to put a dog in the cart. It goes to the home page, selects the Dogs animal category, drills down to the Corgi breed, and, finally, puts a Female Puppy Corgi into the cart. These are the actions of an ordinary user.
The test script is run through an interpreter, a program that trans-lates the functions into interactions with the application. The programmers
|
||
|
|
||
|
Programmers: This chapter is devoted to explaining to the customer’s view of acceptance testing, not the programmer’s. The test script interpreter consists of a few lines of Perl, and uses eval and AUTOLOAD. You could write this yourself, or download my company’s open source implementation from http://www.bivio.biz.
Copyright © 2004 Robert Nagler 59
All rights reserved nagler@extremeperl.org
|
||
|
|
||
All Pages All Books