Wednesday, September 17, 2008

Parameterizing Your Test Script

When you test your application, you may want to check how it performs the same operations with multiple sets of data. For example, suppose you want to check how your application responds to ten separate sets of data. You could record ten separate tests, each with its own set of data. Alternatively, you can create a parametrized test that runs ten times: each time the test runs, it uses a different set of data.

Parametrization can be done in this way:

1. In the sheet "Action 1", write some parameters under column A(change column name"Name") and then enter 10 names like name1, name2....name10

Browser("browser_name").Page("page_name).WebEdit("textbox_name").Set
Datatable("Name","Action 1").

2. In the sheet "Global", write some parameters under column A(change column name"Name") and then enter 10 names like name1, name2....name10

Browser("browser_name").Page("page_name).WebEdit("textbox_name").Set
Datatable("Name","Global").

In default sheet the data will be stored and the script we can modify code like this.

Browser("browser_name").Page("page_name).Webedit("textbox_name").Set Datatable(Name,dtGlobalSheet).
OR
Dialog("Login").WinEdit("User_Name").Set Datatable(Name,dtGlobalSheet).

No comments: