Print Page | Close Window

Adding Logic to the Test Script

Printed From: One Stop Testing
Category: Testing Tools @ OneStopTesting
Forum Name: Rational Robot @ OneStopTesting
Forum Discription: General-purpose test automation tool for QA teams who want to perform functional testing of client/server applications.
URL: http://forum.onestoptesting.com/forum_posts.asp?TID=3467
Printed Date: 22Dec2024 at 3:28am


Topic: Adding Logic to the Test Script
Posted By: tanushree
Subject: Adding Logic to the Test Script
Date Posted: 31Oct2007 at 3:17am
Adding Logic to the Test Script

Adding Logic to the Test Script
In this exercise you will program decision-making logic into the test script using
an if/else statement. This enables the test to:
• check that the total is equal to the number of tickets ordered multiplied by the
price per ticket
• report whether the total is correct or incorrect
1 Place the cursor below the last edit_get_text statement in the lesson7
script.
2 Add the following statements to the test script exactly as they appear
below. Note that the tabs or spaces at the beginning of the second and
fourth lines are optional.
if (tickets*price == total)
tl_step ("total", 0, "Total is correct.");
else
tl_step ("total", 1, "Total is incorrect.");
In plain English these statements mean: "If tickets multiplied by price equals
total, report that the total is correct, otherwise (else) report that the total is
incorrect."
3 Add a comment to describe what this section of the script will do.
Place the cursor above the if statement you added in the previous step. Choose
Edit > Comment. After the # sign, type: check that the total ticket price is
calculated correctly.
4 Save the test.



Print Page | Close Window