Monday, October 11, 2010

How to automate flash chart using Sahi?

Recently we faced the challenge of automating tests for application using fusion charts. FusionCharts v3 helps you create animated & interactive charts for web & enterprise applications. In the application that we were testing, these came embedded in web pages using plain HTML and without using FusionCharts JavaScript class.

Our team’s objective was to test content of the flash chart. This flash chart was a stackarea chart with trending information.
We tried recognizing these charts with Sahi Controller but it got identified as a DIV tag.
And the only identification available was something like _div("ch57").



Here is what we did: We studied the HTML rendered and studied the content of EMBED tag.
When using HTML embedding for FLASH CHARTS, all variables to the chart are passed using FlashVars variable. This is the variable which holds the chart XML data.

REFERENCE - Flashvars takes various parameters as given in the Flash Chart documentation - http://www.fusioncharts.com/docs/ [Embedding Charts Using OBJECT or EMBED Tags].

For developing a sahi script that validates data content of the flash chart we developed following alogrithm.

(1) Navigate to test application where the flash chart is rendered
(2) Recognise the EMBED object using html-id.
(3) Read the tag attribute by the name flashvars
_call (document.getElementsByTagName("embed"))[0].getAttribute("flashvars");
(4) Build an XML object
(5) Validate data of interest by parsing XML

Best way to validate data of interest is to read the XML file at runtime from the application under test and log the datasets to a XML/CSV file. Depending on the business scenario tester can frame the base xml/CSV that is expected. One can then just do a simple file comparison.

Tuesday, April 13, 2010

Nightly Build Testing @ Digite


Nightly Build Testing is a fully automated process at Digité office. Digité Enterprise is internally used to track product development lifecycle. It tracks Requirements, Defects, Change Requests and enhancements for various major and minor releases. Test automation framework is developed using keyword driven approach and QuickTest Professional. Various assets related to automation framework, like QTP Scripts, Functions (Keywords), QTP maintenance – Change Requests, Defects, and Development Sprint plans are also tracked in Digité.

Digité Enterprise Product Source code checkins (commits) to SVN are traced to items tracked in Digité production server using the SVN integration feature. Cruise Control builds latest source code from SVN for various product branches and deploys it to test automation servers.

Test automation framework is developed using keyword driven. It is extensively used to test nightly builds across all product branches. A driver program batches QTP Scripts and runs it in parallel on the latest available application under test (AUT) and logs results in a separate database. Digité Enterprise product (AUT) uses its enhanced logging capabilities to log server side exceptions in to database used by automation framework. Both the application log and the QTP test results serves as valuable inputs to automatically generate product defects into Digité Enterprise product server. ‘PD Generator’, is a custom adapter that analyzes logs and traces it to QTP result timestamp to correlate scenarios which caused the failure on the application side. In this way product (AUT) side regression gets automatically tracked into the system leaving aside QTP code side regressions to be manually fixed.

Since the entire test results are logged in database and traced to items tracked in Digité production, various test metrics and trending information are available online for taking release decisions.

Thursday, January 7, 2010

Web2.0 and Test Automation

I came across some new UI gadgets while researching selenium.
Just go thru the websites, there are amazing UIs. Simply mind blowing.

There are ready made UI gadgets available in the open source world today for any developer to qucikly plug in his application. There are examples with source code and all possible information there.

Just wondering as we move to this new era of UI feature, even the test automation need to change so as to ease Object Identification of these gadgets. Test automation tools need to provide intelligent object recognition options.

QTP 10.0 is suppose to do it. One of the blog says.
There has been no out-of-the-box support for most of the Web2.0 technologies by any of the tools providers out there. Looks like HP has decided to go full force into it and capture all the more commercial functional testing tools market that was already dominated by them. **HP is now planning to release a Web2.0 pack.
QTP does have Flex addin.

Sahi official website indicates that they fully support
Since Sahi uses javascript inside the browser, it works with pretty much any web technology.
Applications using dojo, extjs, gwt, zkoss etc. have all been tested successfully with Sahi.

Selenium does have jars for individual UI components. there is selenium-flex.jar that provides api for testing flex. zkoss is easily tested with default setup of selenium.
Dojo is not easily supported but needs tweeking. Biggest benefit selenium has is XPATH locator.

None of the tools give short cut or easy way to identify these gadgets. Theres good understanding of DOM and Javascript required to correctly calculate position or location or identification of UI element.

http://gwt-ext.com/demo/
This is google web toolkit

http://www.adobe.com/devnet/flex/tourdeflex/web/#
Adobe provides Flex component

http://demos.dojotoolkit.org/demos/fisheye/
DOJO is another javascript library power packed with readymade UI components

http://www.zkoss.org/zkdemo/userguide/#d2
is another ajax library (without JavaScript) for rapid UI development

http://www.extjs.com/deploy/dev/examples/grid/edit-grid.html
Some more jazzy examples are present on this site

http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html
This is open source AJAX library provided by Yahoo.