TESTCASE FIVE - TOTAL OF ALL ORDERS
37
TestCase FIVE
TESTCASE FIVE
Exercise 12a - ExplicitName
Objective
By the end of this exercise, you will be able to rename the Attributes of a Module with the use of an ExplicitName Configuration
Parameter and use the property ResultCount within a TestStep.
Why is this important?
Renaming TestStepValues with an ExplicitName configuration parameter allows Tosca to steer using the index, and take into
account any dynamic changes.
Key elements:
Configuration
Parameter
Instructions
1. Navigate to the Module Folder “11b Orders Page” under Customer>>My Account.
Navigate to the properties of the “Order Total” Module Attribute of the “Order Overview” Module. Change
2.
the InnerText to identify any text containing “Order Total:” within the string.
3. Add the Configuration Parameter “ExplicitName” with the Value “True” for the control “OrderInfo”.
Navigate to the TestCases section, create a Folder named “TestCase 5” and a subfolder named “12a
ExplicitName and ResultCount”
• Add a TestCase named “Total of All Orders”
4.
• Add the Test configuration parameter named “Browser” with the value “InternetExplorer“
• Add the Reusable TestStepBlocks “Precondition” and “Postcondition”
Resolve the reference to the Reusable TestStepBlock “Postcondition”. Delete the TestStep “Continue”.
Create a TestStepFolder named “Orders Page” between the “Precondition” and “Postcondition” Folders.
Create two TestSteps in the “Orders Page” Folder, using the Modules:
5
• Top Menu – rename to “Navigate to My Account”
• My Account Menu – rename to “Navigate to My Orders”
6. Enter the Business Parameters.
7. In the “Navigate to My Account” and “Navigate to My Orders” TestSteps, enter the correct Values.
Run the “Precondition” and “Orders Page” TestStepFolders in the ScratchBook to open the Web Shop to
8.
the correct page.
38
Exercise 12b - TBox Set Buffer and ResultCount
Objective
By the end of this exercise, you will be able to use Tbox Set Buffer Module within a TestStep to set the Buffer “SUM” to the value
“0”.
Why is this important?
When using the “SUM” Buffer, ensuring that it is at “0” prior to the TestCase running will prevent errors caused by existing Buffer
values from previous TestCases still being present.
ResultCount calculates how many controls with the same properties are on the page.
Instructions
1. Duplicate TestCaseFolder “12a ExplicitName and ResultCount” and name it “12b TBox Set Buffer”.
Create a TestStepFolder named “Set Buffer” after the “Orders Page” folder. Add the “TBox Set Buffer”
2. Module (Tricentis Standard Modules>>Tbox Automation Tools>>Buffer Operations>>TBox Set Buffer).
Rename to “Set SUM to Zero”.
Change the Buffer names to:
3. • “SUM” - set the Value to 0
• “OrderNumber” - leave the Value blank
4. Add the Module “Order overview” – rename “Count Number of Orders”.
In the “Count Number of Orders” TestStep, enter the correct syntax to count the number of orders
5
(number of OrderInfo containers) in the Buffer “NumberofOrders”.
Run the TestStepFolder “Set Buffer” in the ScratchBook. Check the buffer that the correct number of orders
6.
has been counted.
Hints
»» The ResultCount property indicates how many of a certain control exist.
39
TestCase FIVE
Exercise 12c - Repetition on Folder Level
Objective
By the end of this exercise, you will be able to instruct Tosca to repeat a TestStep a certain predefined 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.
Instructions
1. Duplicate the TestCaseFolder “12b TBox Set Buffer“ and name it ”12c Repetition on Folder Level”.
Create a new TestStepFolder named “CountUp”, between the “Set Buffer” and “Postcondition”
2.
TestStepFolders.
3. Set the “Repetition” Property Value to the Buffer: “NumberofOrders”.
Hints
»» Repetition can be found in the Properties tab of the TestStepFolder.
40
Exercise 12d - ExplicitName on TestStepValue
Objective
By the end of this exercise, you will be able to change the name of a TestStepValue to steer elements by index and dynamically.
Why is this important?
When elements do not have a unique identifier. ExplicitName allows Tosca to steer using the index, and take into account any
dynamic changes.
Instructions
Duplicate the TestCaseFolder ”12c Repetition on Folder Level” and name it “12d ExplicitName on
1.
TestStepValue”.
2. Add the Module “Order Overview” into the “CountUp” TestStepFolder. Rename it “Buffer Order Total”.
In the TestStep “Buffer Order Total”, locate the DIV “Order Info”. Rename it from “Order Info” to
3.
#{Repetition}. This will ensure that whichever repetition we are on, the corresponding DIV will be selected.
4. In the “CountUp” folder, navigate to the “Order Total” control.
5 Use {XB} to verify and Buffer the price of the “OrderTotal”.
Add a TestStep to “CountUp” folder by adding the “TBox Set Buffer” Module (Tricentis Standard
Modules>>TBox Automation Tools>>Buffer Operations>>TBox Set Buffer). Rename the Module to "Sum
6. Up”.
Enter syntax for the Buffer “SUM” Value which will add the buffered “OrderTotal” amount to the existing
Buffer “SUM”.
7. Log out of the Web Shop and close the Browser. Run the TestCase in the ScratchBook.
8. Set the WorkState to “COMPLETED”.
41