Forums | Downloads | Live Demo | Product Home
Building Maintainable Test Scripts for Functional Testing Gibu Tue Mar 25, 2008 6:46 am
0 Comment    Post Comment
Today we have a guest blog from Rajasankar, the QA Manager for the Network and Server Monitoring Software from AdventNet. I am reproducing it below. It elaborates the experience of a user who has automated over 2000 Test Cases.


Quote:

Building Maintainable Test Scripts for Functional Testing
When I started Automation for OpManager, I am new to automation so, I've started reading about the automation concepts. When I tell someone that I am doing UI automation, the first question is "What you will do when the UI changes". I don't have an answer for that question.

The material available is also not helpful. In one side, puritans advocating using a script based language for creating test cases, ie. doing the coding from the scratch. On the other side, tool vendors(including us) claiming that record and playback tools can automate with less effort. I thought, let's try to do automate and learn the things on the way. After the three months efforts, I've posted my feedback here.

Now, I need to make the automation tests in a maintainable way. I continue read about automation. In a Google video, Cem Kaner, a software testing expert, giving a lecture about GUI regression testing. He asked one question that stirred my thought. In programming, if we need do same action repeatedly, we will write a function and call it wherever needed. If we need to change something, we will change in that function. Why we are not using it in automation? Then, he went about having a interpreter and using the excel sheets for defining actions.

In QEngine, for DB check, I've defined custom functions, called those in the QEngine UI . Say, if Polled data table needs to be checked for entry of a monitor, define the queries as a function and call it wherever it is needed. I thought, why can't those functions be used for GUI actions. I've tried that in the Discovery module.

Let me give an example, how it works. Usually the script for adding a credential looks like this,

Code:

changeURL("http://opman-winxp/",6)
setWindow( "AdventNet OpManager",1)
setText("userName","admin",1)
setText("password","Aye%?=",1)
clickImage("http://opman/images/Login_submitBut.gif",1)
setWindow( "OpManager",5)
clickLink("Admin",1)
setWindow( "OpManager",5)
clickLink("Discover Devices",1)
setWindow( "OpManager",7)
clickElement("Add Creden",1)
setWindow( "OpManager",1)
setText("snmp1Detail_1","testsnmp",9)
clickElement("Add",1)
setWindow( "OpManager",12)
clickElement("Add Creden",1)
selectItem("credentialType","Windows",1)
setWindow( "OpManager_windows",1)
setText("winDetail_1","testwmi",1)
setText("winDetail_3","administrator",3)
setText("winDetail_4","A<d%ub",1)
clickElement("credaddbutton3",1)
setWindow( "OpManager_windows",16)
clickElement("Add Creden",1)
selectItem("credentialType","Telnet/SSH",1)
setWindow( "OpManager_telnet",1)
setText("linDetail_1","test2",3)
clickElement("credaddbutton4",1)
closeLastWindow()


If you use the functions, it will look like this,

Code:
callScript("001","001")
gotocredential()
addsshfirst("test1","guest","guest","*","*","*")
addssh("test2","test","test","*","*","*")
closeLastWindow()


You can also use CSV files as an input,

Code:
callScript("001","001")
gotocredential()
addsshfirst("test41","test42","test43","*","*","*")
initDataSet("013")
result = getValuesFrom("013")
for i in range(1,len(result)):   
   A=result[i][0]   
   B=result[i][1]   
   C=result[i][2]   
   D=result[i][3]   
   F=result[i][4]   
   G=result[i][5]   
   addssh(A,B,C,D,E,F)
closeLastWindow()



It works great. There is one more advantage of this approach. If you give the values from CSV files for input, you can do lot of testing. The monotonous tasks of doing a same thing repeatedly by manually will be removed .
How about adding 1000 different credentials that includes all the special characters in OpManager?

Now, comes the basic question, "What to do if the UI changes?". Well, if you use functions, you don't need to worry about that. Even if the UI is completely revamped, in very short time you can recreate the entire cases because you need to record the actions for one time in order to create the map file in QEngine.(I think this will be the same with most if not all of the tools). I am not claiming that this will resolve all the issues related with UI automation. However, one major part of the problem can be avoided in this way.

Thanks to KPS for sharing his scripts. The same approach is used by him to test ZohoDB .


Rajasankar
QA Manager
OpManager,
AdventNet



Users of QEngine who would like to share their experiences, please mail it to our support mail id or post it in your personal blog and we will highlight it in this blog too !
  
 
AJAX testing using QEngine Raghavan Mon Oct 15, 2007 12:32 pm
1 Comments    Post Comment
In this blog i am going to speak about functional testing Ajax based application using QEngine.

AJAX means Asynchronous Javascript And XML

First i will brief how normal application will be recorded and played back in QEngine,

On start recording and clicking on the elements in the web page will generate script for QEngine. The script will look like below

Code:
setWindow("title",<wait_time>)
clickButton....


Here the click button is the action you performed on the application.

What is setWindow ? Here i will explain it,

During playback, playback engine needs to identify the window to perform further action in the page. setWindow is used to identify the browser window in which the target element is present.

setWindow will be recorded in the script in the following scenario,
    i) whenever the page is refreshed or loaded freshly
    ii) whenever the action is performed in the alternative window during recording
    iii) whenever a new window is launched and some action is performed there.
    iv) whenever the page title changes during any action perfromed in the application

During playback of the script , QEngine can identify the window over which the desired action to be fired.

Also during playback, setWindow call will wait for the page to load completely before proceeding to perform further script actions.

Now come to AJAX application. In AJAX following scenario will be difficult to handle using normal setWindow call.

Scenario 1:

AJAX will asynchronously send the request and dynamically add element's to the page without refreshing / loading the page.

Possible Problem

As the elements are getting loaded dynamically, there may be a chance of setWindow may not get recorded. Hence during playback, if there is any network delay the element's might loaded with delay.
But QEngine will look for the elements immediately which may not be there. Due to which the script may fail.

Solution

QEngine has in-built function which will take care of handling such scenario.

In QEngine there is a separate category for "AJAX Functions". The AJAX functions contains the following functions,

waitForElement & waitForDynamicElement- This will wait for the recorded element to appear in the page. Once it idenifies the element in the page it will proceed to fire the needed actions.
waitForText - This will wait until configured text appear in the page. After the text is displayed in the page, this will proceed for further actions in the script.
waitForTitle - This will wait until window with configured title is found.
waitForElementRemoval & waitForDynamicElementRemoval - This will wait for the recorded element to be removed from the page.

The timeout for wait can be configured for the above functions, to stop waiting and proceed for further actions.

Before proceeding with the further script action's in the above specified scenario you can insert following script line to wait for the element to show up in the page,
Code:
waitForElement("<element id as recorded by QEnigne>",20)


The above statement will make QEngine to wait for the element to show up in the page for maximum timeout of 20 sec. If it is doesn't show up then it will proceed to further script actions.

Scenario 2:

There will not be page navigation in the application. Instead the complete page will be shown on AJAX request. Ex: Typical Backbase based web application.

Possible Problem:

Here the setWindow will be recorded only once. But the page might change on various page submit.

Solution

Here also you have to use appropriate AJAX function listed above to handle page changes.

Where to insert the AJAX function in the script,

Next to the action which caused the page to change, you should insert the AJAX functions, which will make QEngine to wait until specified element to show up.

Summary: QEngine has the powerful set of functions which can be used to automate AJAX rich applications.

I will catch you with different tips to effectively use QEngine for the automation in my next blog.

Cheers,
Raghavan
  
 
Goal of Performance Testing Chandru Tue Jul 03, 2007 2:44 am
6 Comments    Post Comment
The goal of performance testing is not finding bugs, but to remove the bottlenecks from the application and improve the efficiency.

Before doing a performance testing we basically need to know the following points
    1. Expected no of concurrent users or HTTP connections with your application
    2. Acceptable response time for your pages

For performance tuning basically we have two approach.

In Approach1(white-box), we can do the following,
    Code Analysis, We can search for poor algorithms or looping which is the reason for inefficiency.
    Database Analysis, We can use query optimizers and profilers to optimize the database.
    Hardware & Network, We can use utilities such as top, iostat to monitor hardware resources and ntop, netstat to monitor the network and Sockets.

In Approach2(black-box), for a Web application, testers will use tools that simulate concurrent users/HTTP connections and measure the response times automatically. If the response time does not meet your expectations tuning has to be done at application/hardware/database level.

In Tuning,

First we need to enhance the application code efficiency, then we can optimize the database.

If still your application doesn't meet your requirements then the following steps will help you.
    1. Using cache mechanisms.
    2. Publish highly requested pages statically, so that they don't hit the database.
    3. Scaling Web servers horizontally via load balancing.
    4. Scaling database servers horizontally and split them into read/write servers and read-only servers.
    5. Scale the servers vertically by adding more hardware resources (CPU,RAM)



Points to remember,

We should take care such that one variable is modified at a time and redo the measurements.

Functionally the application should be well tested and must be in good quality. i.e., the software under test is already stable enough so that performance testing process can proceed smoothly.

Usage of QEngine,

Using QEngine, you can simulate thousands of users load to your web application and you can monitor the servers and databases during load test easily.

QEngine supports all web applications irrespective of the domains. It has the capability of load testing AJAX based applications too. It has exhaustive parameterization support for dynamic applications.

Regards,
Chandru

Be proud to be a tester, Enjoy testing.
  
 
Web 2.0 introduces AJAX testing requirements Gibu Mon May 21, 2007 6:48 am
3 Comments    Post Comment
Lots of web applications have started embracing Asynchronous Javascript and XML (AJAX) which is a development technique to build more usable and interactive web applications. We have quite a few product Teams in-house itself using AJAX and it sure is an emerging development trend. However this has brought more challenges to functional testing and performance testing team now. The increased usability for end users comes with a price. Complex Javascript coding, which means testing becomes even more important.

The problem gets aggrevated as traditional web application testing tools do not support AJAX testing. However QEngine supports AJAX Testing of Web Applications. In the last Service packs we have considerably improved our support for AJAX Applications. Some of the basic functionalities users need are :

a) wait till a new html element appears or is removed from the DOM
b) wait till the title of the web page changes etc.

With support for AJAX functions in QEngine, you can now cover most usecases of the next gen. Web Application Testing.
  
 
Load Testing needs deep diagnostics too Gibu Thu May 17, 2007 5:01 am
0 Comment    Post Comment
Most project teams run their software through extensive functional testing, load testing and stress testing before releasing the product. It would really feel great if your application could meet the scalability requirements in the very first version that comes to QA Phase. However that is not the case as most development teams worry about performance testing their web applications at the fag end of development. This puts added pressure on the development team to deliver faster.

Now you wear your QA hat and use QEngine for Load Testing and figure out it cannot scale. What next. Where is the bottleneck ? That's when you need some diagnostics tools. AdventNet ManageEngine Applications Manager can help you speed up the bug fixing phase after a load test by pin-pointing exact Java methods that take more time to execute. This is a product complementary to QEngine and forms the Application Performance Management suite from AdventNet.

Specifically the J2EE Web Transaction capability helps a user to visualize the breakup of response times from a URL up to the response times of underlying Java methods and database queries.


Happy debugging after your load tests ...
  
 
Welcome to QEngine Team blog!
Search this blog
Visits for this blog: 146403
 
Previous Posts
» Building Maintainable Test Scripts for Functional Testing
» AJAX testing using QEngine
» Goal of Performance Testing
» Web 2.0 introduces AJAX testing requirements
» Load Testing needs deep diagnostics too
» Architecture : Web Application testing using QEngine
» QEngine 6.7 Released...
» Testing Dynamic Web Applications
» QEngine Review in Dawn Science Tech World
» Want to test your web application in different servers
 
BLOGROLL
 
Categories
All
General
 
Archives
Mar 2008
Oct 2007
Jul 2007
May 2007
Jan 2007
Sep 2006
Jun 2006
May 2006
Apr 2006
© 2006 AdventNet Inc. All rights reserved.