Ask a Question

Writing script test to validate text which has some part dynamic but the rest remains the same

SOLVED
SS01
Occasional Contributor

Writing script test to validate text which has some part dynamic but the rest remains the same

I would like to know a way to validate some text on search page using javascript which is returning number of items based upon what has been searched but the remaining text remains the same (e.g. 20 items found or 0 items found where 20 and 0 can change but remaining text remains the same). I would want the test to pass as long as there is a number coming back doesn't matter if it is a zero. A test should fail if nothing is coming back in the number place.

3 REPLIES 3
Mr_Bro
Frequent Contributor

@SS01 ,

 

please try using the aqString Object Methods  which would suite your case.

SS01
Occasional Contributor

Thanks for that. Could you please also suggest which method out of these would work here to validate a static text containing some dynamic number so the test pass. If it is returning a number anything >=0 it should pass else fail. 

Mr_Bro
Frequent Contributor

try using the aqstring.find to validate the substring of the complete text and based the result you can log the message or error

cancel
Showing results for 
Search instead for 
Did you mean: