Reusable test to verify a fields maximum length

Tips and Techniques

Moderators: ZeenyxSupport, blesuer

Post Reply
ZeenyxSupport
Site Admin
Posts: 17
Joined: Thu May 24, 2012 3:53 pm

Reusable test to verify a fields maximum length

Post by ZeenyxSupport »

This is a reusable function that can be used to verify the maximum field length of your edit fields regardless of the target application's platform. Provide the full object name of the field to be verified along with its expected maximum field length. An error will be raised if the maximum field length is shorter or longer than the expected max field length.

Code: Select all

[-] VerifyMaximumFieldLength (AppObject FieldName, Integer FieldLength)
   [ ]
   [ ] String TestString = ""
   [ ] 
   [ ] TestString = String.Replicate("a",FieldLength)
   [ ] 
   [ ] FieldName.SetText (TestString + "x", false)
   [ ] 
   [ ] FieldName.VerifyValue(TestString)
Usage: VerifyMaximumFieldLength (MyDialog.MyTextField, 8)

If you include this function in your project, it will show up automatically in the Actions Explorer in the 'User Defined folder' so that you can easily drag it into your steps.
Post Reply