Sunday, May 8, 2011

Standard Scripting languages in Test Automation


By standard scripting languages, I mean, JavaScript, Python etc. To know more about how non standard scripting languages used in test automation, please read Hey Vendors, Give Us Real Scripting Languages by Bret Pettichord. Even, though, it was written in 2001, the points made is still valid today.

Another aspect is using the standard locators in UI element locators. Let me explain with one example. I had a OR condition in  the element locator. In non standard locators, I am forced use this following script

Check if Element A is present

if A is present click A


Click Element B

Which means I need to make at least two calls to check if the particular element is present.

Consider the multiple selector option and multiple attribute selector in jQuery,

Multiple Selector (“selector1, selector2, selectorN”)

Multiple Attribute Selector [name="value"][name2="value2"]

Click (Element A,Element B)

If I can use the above selector formats, just one step is enough. Add to this how many lines I don’t need to type to check this. Instead of four lines, script will have only one line. I choose jQuery as example. Those formats are actually CSS selectors.

Next time if you’re still using a old custom format for element locators, think about CSS.


raja's shared items

My "Testing" Bundle