SilkTest Question:

Download Job Interview Questions and Answers PDF

How to Setting Max value?

SilkTest Interview Question
SilkTest Interview Question

Answer:

Here's the function you need to verify that an object (TextField) accepts a max char limit.
[code]
[+] boolean VerifyMaxChars (window wTarget, integer iMax, string sChar optional)
[ ]
[ ] string sText = ""
[ ] string sComp
[ ]
[+] if sChar == null
[ ]
[ ] sChar = "A"
[ ]
[ ]
[ ] sText = Replicate (sChar, iMax)
[ ]
[ ] wTarget.TypeKeys (sText)
[ ]
[ ] sComp = wTarget.GetText ()
[ ]
[+] if sText != sComp
[ ]
[ ] Verbose ("Verify Max Chars failed, expected number {iMax}, actual {Len (sComp)}")
[ ]
[ ] return false
[ ]
[ ]
[ ] sText = Replicate (sChar, iMax + 1)
[ ]
[ ] wTarget.SetText (sText)
[ ]
[ ] sComp = wTarget.GetText ()
[ ]
[+] if sText == sComp
[ ]
[ ] Verbose ("Verify Max Chars failed, expected number {iMax}, actual {iMax + 1}")
[ ]
[ ] return false
[ ]
[ ]
[ ] return true
[ ]
[/code]

Download SilkTest Interview Questions And Answers PDF

Previous QuestionNext Question
WhaIs there a specific way to run a script from a point what I prefer, which is similar to run from cursor option in Winrunner? Any patch, adding, etc that enables this option in Silk.?Can SilkTest switch browsers automatically?