Task Description: Online shopping cart
is arguably the most important part of an E-Commerce site. Testing shopping cart is essential to success of any
E-commerce site. This task shows how you can test online shopping cart.
Note: This sample task uses an example of www.barnesandnobel.com just for illustrative purposes.
| Solution |
| 1. | Record a new task |
- Click on Tools->Web Recorder.
- Type in http://www.barnesandnobel.com/ and click on Start
- Select ISBN from the dropdown. Enter any ISBN number for e.g. 074322566X.
- Click on Search.
- Click on 'Add To Cart'
- Click on 'View Entire Cart'
- Click on 'Import Table' button from the toolbar on the bottom right hand corner of the screen.
- Click in the 'Price' column to capture the pricing table.
- Stop Recording and Save the task.
|
| 2. | Validate your Shopping Cart |
- After Import Table command is executed, you can use System Variable command,
$Table Column(index)$ to extract the row data of the Table when the task runs.
- Open the Task in Editor to insert loop and conditional commands to validate the shopping cart.
- Insert a Conditional command inside the Loop command to verify if the $Table Column(4)$ has the value 16.00 i.e.
the price of the book. Screenshot 1
- This way when you run the task it will import the tabular data of the shopping cart and look for the expected price and if found, will show a message box
How to find which index to use in System Variable $Table Column$?
- While recording, when you click on the Import Table and capture a table, it will ask you for a csv file name.
- Specify a valid filename.
- Run the recorded task once. It will generate the csv file.
- Open the csv file in Excel and find out which column your data is in and that is the index you need to use.
Screenshot 2
|
| |
| When you run this task, it adds one book to the cart and validates the expected
price of the book in the shopping cart. |
Screenshot 1: 
Screenshot 2: 
|