Vendor Script Functions in QEngine.
Before seeing what are the vendor functions, we need to understand what is Vendor Scripting?
Vendor Scripting defined as script/functions specific to the program or application. In other words, such functions available only in that application and won't be used anywhere else.
Vendor scripts can be a deciding factor in the learning curve of the automation tool. The more vendor scripting, more time needed to learn.
Here is the separation of vendor scirpt and common functions
1. Window Functions or Dynamic Functions
2. HTML Special Functions
3. HTML Check Functions or HTML Get Functions
4. AJAX Functions
5. Invoke Script Functions
6. General Functions (optional)
7. Default Recorded Functions(optional)
Common functions
1. XML Validation Functions
2. String Manipulation Functions
3. File Manipulation Functions
4. E-Mail Functions
5. Date Functions
6. Database Functions
Check this page for all functions available in the QEngine.
Rajasankar
rajasankar at zohocorp dot com
In this article, I am going to show, how to follow the web links in the Dynamic web page is easy with QEngine.
Here are the two function used in that.
You can get the DOM element property with the following function,
| Code: |
| getElementProperty(tagName,propertyName,propertyValue,index,propertyNeeded,regExpRequired='false')
|
| Code: |
| fireEventOnElement(tagName,propertyName,propertyValue,index,actionName,actionValue='',regExpRequired='false')
|
| Code: |
| getElementProperty("A","href",propertyValue,index,"href",regExpRequired='false') |
| Code: |
| getElementProperty("A","href",".*",index,"href","true") |
| Code: |
|
i=1 while i>0: values=[] setLastWindow() property=getElementProperty("A","href",".*",i,"href","true") if property is not None and property!='': values.append(property) i=i 1 else: i=0 return values |
| Code: |
|
for i in range(0,len(values)): setLastWindow() fireEventOnElement("A","href",values[i],i,"click","NONE","false") |
| Code: |
|
for i in range(0,len(values)): setLastWindow() url=" fireEventOnElement("A","href",url,i,"click","NONE","false") |
In Notepad
you can add function complete for custom languages. Existing Auto
Completion files can be edited too which means I can add QEngine
functions too.
I've spent an hour to add the QEngine functions into python.xml
file. Now, I don't have check the Framework.py for the syntax of the
functions.
The QEngine script file has extension of .wcs, associate that to
the python language and see the difference. Those files will be located
in the /QE home/projects/
Here is the file, change the extension into .xml and replace that under /Notepad home/plugis/APIs/.
This feature also available in the QEngine inbuilt editor. If you need this one for any other text editor, let me know.
Rajasankar
rajasankar at zohocorp dot com
I've discussed overcoming the user interface/ web interface changes here. Script maintenance and related issues are discussed here. Take a look at the Script maintenance guide here. The examples used in those articles are simple ones. However, in real world testing, we'll encounter complex web interfaces to deal with.
We know we can use Dynamic Functions of QEngine to handle any element that is added dynamically in the web application. How about using those functions for a static element which might change in future.
Let me explain using an example. When I am automating OpManager, I've encountered a situation to check the device snapshot pages.
A,B,C are device names in the network. I need, QEngine to click on these links. Discovery of the devices will run on everyday to check the daily build performance of OpManager. If any device is down at the time of the discovery, it wont make into this list. Sometimes, the name of device may be changed or may be removed from network. When I record this page using QEngine, I've got this,
| Code: |
| clickLink("A",1)
setWindow( "OpManager",1) clickLink("Server",1) setWindow( "OpManager",4) clickLink("B",5) setWindow( "OpManager",7) clickLink("Server",1) setWindow( "OpManager",4) clickLink("C",5) |
| Code: |
| setWindow( "OpManager",1)
fireEventOnCellElement("main",1,2,"click","NONE","NONE","NONE","NONE",1) fireEventOnCellElement("main",1,3,"click","NONE","NONE","NONE","NONE",1) fireEventOnCellElement("main",1,4,"click","NONE","NONE","NONE","NONE",1) |
Automated Testing is a good concept. Most of the testers go for manual testing in spite of huge cost benefits by automated testing. The following reason is cited for not using automated testing,
| Quote: |
| Changes in Web Interface/User Interface will make the test automation not feasible. |
| Quote: |
| Create scripts using defined functions instead of recording every script. |
| Code: |
|
launchApplication("about:blank") changeURL("http://opman-winxp/",5) setWindow( "AdventNet OpManager",1) setText("userName","admin",1) setText("password","admin",1) clickImage("http://opman-winxp/webclient/common/images/Login_submitBut.gif",6) |
| Code: |
|
def login(usename,password): launchApplication("about:blank") changeURL("http://opman-winxp/",5) setWindow( "AdventNet OpManager",1) setText("userName",usename,1) setText("password",password,1) clickImage("http://opman-winxp/webclient/common/images/Login_submitBut.gif",6) |
| Code: |
|
login(admin,admin) |
| Code: |
|
def login(usename,password): launchApplication("about:blank") changeURL("http://opman-winxp/",5) setWindow( "AdventNet OpManager",1) setText("userName",usename,1) setText("password",password,1) clickImage("http://opman-winxp/webclient/common/images/Login.gif",6) |