| || |
I recently began learning SilkTest and I am in need of some help... I need to create testcases that verify that certain fields are alphanumeric, just numeric, or just alpha. Also I need to test that some fields have specific length of characters. I vaugely remember something about alphanumeric fields from training but haven't had any luck finding more information on it...
Any input is greatly appreciated!!!
You're going to have to script this. Essentially, to confirm that a field only accepts alpha characters (i.e.- a-Z), use SetText ("1234567890") and then verify that GetText returns an empty string.
As for verifying capacity.... If the capacity of the TextField object is supposed to be, for example, 20 characters, put 21 characters into the field and then verify that GetText is 20.
You could also modify the TextField class to have methods to do all of this for you. Hmmm...maybe I'll do that today.
[This message has been edited by dcreed (edited 08-14-2001).]
A concerned Borland customer, a fly in the ointment, a wrench in the works.
OK, you should probably be able to manage that. Assuming that a textfield being numeric (to take one example) means that certain characters (anything except the digits 0-9) should be rejected; the mechanism of this can vary, but commonly it is implemented as other characters typed into the textfield are not displayed, and a beep is sounded.
With a judicious combination of TypeKeys (to get exact control over what you're doing) and GetText (to find out what it's displaying), you should be able to confirm that disallowed characters are being correctly rejected by your textfield.
I suspect that the best way of doing this would be to implement a method or a group of related methods in the TextField class (see Extending The Class Hierarchy in the manual for details of how to do this), which will make the writing of multiple testcases of this kind (on different textfields in your aut) fairly straightforward.
I hope I've made myself clear; I don't know how to go into further detail without more information about how your developers intend to implement a textfield being alphabetic/alphanumeric/etc.
One possible problem I can see with this approach is if you run into the problem referred to in http://www.qaforums.com/Forum1/HTML/002227.html where even though your aut's field is not displaying an invalid character in the textfield, silktest still sees it. In that case, some experimentation with the different methods available to you (e.g. GetProperty, VerifyValue, GetContents) to see what works in your situation.
[This message has been edited by vincebowdren (edited 08-14-2001).]