Field validation testing in QTP:

Field validation testing in QTP:

Field size validation is a tedious task for testers when form is long and fields are many.What if a certain line of code perform all this monotonous task within a result? I am sure you must say Ahhhhh! Don’t you say thank you to the tool 😉

We can create a function that checks the field size and call the function whenever field appears on the form.The function could be made more reusable by passing page name/Form name and field name as an argument.


'Function: FieldValidation()
'Description:Validating the max size of text box
'Author:QTP Lab:--A touch of madness
'Last modified:18/06/2010

Function FieldValidation()

‘Validating the max size of text box i.e 50(req.)

SystemUtil.Run “iexplore.exe”,””
upp_bound=Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“name:=s”).GetROProperty(“Max length”)

If CInt(upp_bound)=50 then
  Reporter.ReportEvent micpass ,”UpperboundaryValue=”&upp_bound,”Passed”
 Reporter.ReportEvent micfail ,”Upperboundary test”&upp_bound,”Failed”
End if

End Function

Thank you!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: