Posts

Showing posts from December, 2011

Incremening DataTable values using DP

If you ever came across a situation in which you need to login into the application and do separate steps than you might be interested in this post. One way to do so is to change action properties and change it to run on all rows, but that will be executing when it completes 1 cycle. what i will be doing here is, dealing with nested actions, a main action will be calling another actions. For example you have a login action and one more action that selects one of the three options on the basis of login id. So you login the system three times every time with a different id. Create a global sheet paramenter runCount that will stores login count and another parameter currecntCount that will select the option. Its always a good practice to create a main action that calls other actions. So the main action will look like this. ''''''Initialize a variable ''''''Set runCount = 1 in datatable i = DataTable("runCount",dtGlobalShe

All about Dates using QTP

Majority of applications have Calendars controls. Automating a calendar can be painful at times if the textbox is disabled, and it only works if you select the date from the calendar widget provided on your website/application. I have been working on date controls for couple of months so thought about sharing all the findings with you people. So here i am summarizing some of the checks which can be handy working on date/Calendar controls. '''''' '''''' Compare start and End date For comparing end date validation, set today's date using Date function in start date textbox and set previous date in end date, and check if the validation is fired.   '''''startdate - set as todays date using 'date' Browser("").Page("").WebEdit("").Set Date '''''End date, set prev 5 days date Browser("").Page("").WebEdit("").Set DateAdd("

QTP Parameterization (all types)

Image
The what?   Parameterization is a process in which you can pass multiple sets of data, variables to remove hard coded values. For example, if you need to check ten login credentials if they are valid or not, worst approach to be adapted by you will be executing the code ten times, problem redundancy and wrong approach. Alternatively you can just pass values in the datatable (Excel like sheet provided in QTP). so you can test multiple set of data in one action or call. The ways? There are three ways to parameterize your data using QTP. Using Datatable (Global or Action specific)   Using environmental variables (User defined, Built-in)   Using Random (built-in function) 1. Using DataTable Datatable values can be used in two ways. Either using Global sheet or Action specific sheet. Global sheet as the name says allows acess throughout your test, across functions or actions, the data (columns) declared here can be used globally within the test. Syntax is given below . ''&#

Passing Long Integers from datatable using CDbl

Image
You might have wanted to pass long integers like from 10 - 13 digits and every time you execute your code, QTP datatable changes your integer value into some scientific value containing plus(+) and decimal signs. Changing the column 'Format' does not seems to be beneficial. (At least not for me). For example if you have tried automating a payment form that takes in credit card number and other details, you might have came across this problem. So here i will be telling you about some very useful build-in functions that can help in this error. Executing the code below will give you an error of invalid input as the value in your datatable will be something like 1.111111111E+111. Browser("name:=.*").Page("title:=.*").WebEdit("html id:=some id").Set DataTable("CardNumber",dtGlobalSheet) Changing column format to Fixed, Custom or any other will give you following error 'The parameter is incorrect' So let us play with some variables