0% found this document useful (0 votes)
6 views2 pages

Exercise 30

This document provides instructions for setting up a TestCase in Tosca to repeat a TestStep a specified number of times, specifically for emptying a shopping cart. It outlines the steps to add and rename modules, configure properties for repetition, and run the TestCase. Additionally, it includes hints for counting rows in a table using the 'RowCount' function.

Uploaded by

ramyajupally514
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Exercise 30

This document provides instructions for setting up a TestCase in Tosca to repeat a TestStep a specified number of times, specifically for emptying a shopping cart. It outlines the steps to add and rename modules, configure properties for repetition, and run the TestCase. Additionally, it includes hints for counting rows in a table using the 'RowCount' function.

Uploaded by

ramyajupally514
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ADDITIONAL Content

Exercise 30 – Set Repetition on Folder Level


Objective
By the end of this exercise, you will be able to instruct Tosca to repeat a TestStep a specified number of times.

Why is this important?


Certain processes may need actions to be repeated a certain number of times. The number of repetitions can be set within
this property. For example, in this case we can use it to completely empty our shopping cart without using a WHILE statement.

Instructions

1. In the TestCase Section, navigate to Additional Material>>Exercises>>Repetition.

2. Within the “Empty Shopping Cart” TestCase, navigate to the “Process>>Empty Shopping Cart” folder.

Here add the following Modules in this order:


• "WebShop | Shopping Cart", rename it to “Verify Table Exists”.
3.
• "WebShop | Shopping Cart", rename it to “Count Number of Unique Items in Cart”.
• "TBox Set Buffer", rename this TestStep to “Calculate Items in Cart Without Header”.
Make sure that the TestSteps within the “Empty Shopping Cart” Folder are in this order:
• Navigate to Cart
• Verify Table Exists
4.
• Count Number of Unique Items in Cart
• Calculate Items in Cart Without Header
• Update Shopping Cart
Inside the “Calculate Items in Cart Without Header” change the TestStepValue Name from “<Buffername>” to
5.
“ActualCartNumber”.

6. Inside the “Empty Shopping Cart” Folder, create a new TestStep Folder and name it “Select Remove”.

7. Place the “Select Remove” Folder after the TestStep “Calculate Items in Cart Without Header”.

In the Properties for the folder “Select Remove”, for the Attribute “Repetition”, add the value
8.
“{B[ActualCartNumber]}”.
Inside the Folder “Select Remove”, add the Module "WebShop | Shopping Cart", and rename this TestStep to
9.
“Empty Cart”.

10. Enter the values within your newly created TestSteps as per the table below:

TestStepFolder TestStep TestStepValue Value ActionMode


Empty Shopping Verify Table Exists Shopping cart Products Exists==True Verify
Cart Count Number of Shopping cart Products Select
Unique Items in
Cart <Row> ResultCount->CartItems Buffer

Calculate Items
in Cart Without ActualCartNumber {MATH[{B[CartItems]}-1]} Input
Header

52
TestStepFolder TestStep TestStepValue Value ActionMode
Select Remove Shopping cart Products Select
Empty Cart Rename “<Row>” to
Select
“${Repetition}”
Rename “<Cell>” to “Remove”
by selecting it from the Select
dropdown
Checkbox Remove (Right
under the Cell now named True Input
${Repetition})

Insert user and password credentials in the "Precondition" TestStep and run the TestCase in the
11.
ScratchBook.

12. Change the TestCase WorkState to “Completed”.

13. Save your work.

Hints
» To count the rows of a table like the one in this exercise, you could also use the function "RowCount" as shown
below:

TestStepFolder TestStep TestStepValue Value ActionMode


Empty Shopping Verify Table Exists Shopping cart Products Exists==True Verify
Cart Count Number of
Unique Items in Shopping cart Products RowCount->CartItems Buffer
Cart
Calculate Items
in Cart Without ActualCartNumber {MATH[{B[CartItems]}-1]} Input
Header

53

You might also like