Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Extreme Programming in Perl Robert Nagler phần 5 docx
Nội dung xem thử
Mô tả chi tiết
implement the functions on demand for the customer. The functions are
responsible for checking the computer’s role in the script. For example, this
test script states that the user clicks on the Dogs link on the home page.
If the Dogs link is missing from the home page or spelled incorrectly, the
follow link action stops and indicates that the test script has failed. This
approach is called fast fail, and makes it easy to write and maintain test
scripts. In keeping with the movie script analogy, it’s like when the director
sees computer screwing up its lines, and yells, “cut!”. Everybody stops. The
director corrects what’s wrong, and the actors start over again.
The next section tests the search facility. We should be able to find our
dog by searching for corgi, CORGI, and dogs wales. We aren’t particularly
interested in Corgis7
, rather our goal is to test that the search mechanism
is case-insensitive and supports multiple words. And, most importantly, the
list of search results allows the buyer to place found animals in their cart
easily. Shoppers should be given an opportunity to buy what they find.
8.4 Group Multiple Paths
8.4. GROUP MULTIPLE PATHS
The previous example demonstrated testing multiple paths, that is, different
ways of doing the same thing. In one case, we searched for a Female Puppy
Corgi hierarchically, and then we used the search box to find the same dog
using different keywords. Here is another example that demonstrates multiple paths:
test_setup(’PetShop’);
home_page();
follow_link(’Reptiles’);
follow_link(’Rattlesnake’);
add_to_cart(’Rattleless Rattlesnake’);
remove_from_cart(’Rattleless Rattlesnake’);
search_for(’Angelfish’);
add_to_cart(’Large Angelfish’);
update_cart(’Large Angelfish’, 0);
7 Or other high-energy small dogs.
Copyright c 2004 Robert Nagler
All rights reserved [email protected]
60