Sponsored Ad

Monday, November 15, 2010

How to Check for parameter in DataTable in QTP Automation Testing

While using datatable in QTP you may want to check that the parameter exist in datatable or not. The below code will help you to find out the that given parameter exist or not.

Here dtGlobalSheet is data table and Param_Name is parameter name. once you run the  val=DataTable("Param_Name",dtGlobalSheet) statement you can check  if err.number <> 0 , it means error occurred due to previous statement running. and given parameter does not exist in datatable.

on error resume next
val=DataTable("Param_Name",dtGlobalSheet)
if err.number<> 0 then
'QTP: Datatable Parameter does not exist
else
'QTP: Datatable Parameter exists
end if

0 comments:

Post a Comment

Related Software Testing Articles



Website List