DamithLiyanaarachchi
349 views
24 slides
Oct 21, 2015
Slide 1 of 24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
About This Presentation
No description available for this slideshow.
Size: 226.71 KB
Language: en
Added: Oct 21, 2015
Slides: 24 pages
Slide Content
Flash Testing with Selenium RC Malinga Thennakoon Damith Liyanaarachchi
Finding suitable framework to capture flash objects in web browser automation testing. Configuring them with the existing framework. Analyzing major drawbacks of the existing tools and finding better tools for flash object capturing. Research Objectives
Flash objects communicate with the browser with its platform dependant native methods. Flash objects are implemented using Adobe Action Script as Flash applications or MXML and Action Script as Flex Applications. Flash UI Components do not have XPATHs. Flash Objects communicate with both client side and server side simultaneously , therefore difficult to identify parsing parameters. Why Flash Object capturing is difficult ?
For the Millennium BBO application ,it’s Flash components dynamically communicate with the server to retrieve information using external JavaScript files. HierarchyViewer.swf uses adfHierarchyViewer.js to retrieve data from the MIT server. HierarchyViewer.swf is created dynamically at the run time by the ADF faces technology and also created using JDeveloper tool at the development time. No API is published. Some Examples …
Flash objects on a webpage are accessible by some JavaScript functions. Such as GetVariable ( varName ) SetVariable ( varName , varValue ) TCallLabel (target, label) Flash API consists of a class called External Interface in order to interact with the JavaScript functions. Action Script JavaScript Communication
Two main functions are used Call method() AddCallBack method() public function ColoredSquare() { currentColor = COLOR_HEX_VALUES[ currentColorIndex % 3]; updateButtonLabel (); drawButton (); addEventListener ( MouseEvent.CLICK , buttonClicked ); // functions available for JavaSript calls ExternalInterface.addCallback (" getColor ", getColor ); ExternalInterface.addCallback ("click", changeColor ); ExternalInterface.addCallback (" getSquareLabel ", getSquareLabel ); ExternalInterface.addCallback (" setSquareLabel ", setSquareLabel ); } Action Script JavaScript Communication
ExternalInterface.Call method This is used to call JavaScript functions from the ActionScript code. Eg :- ExternalInterface.Call (“ callToJS ”); ExternalInterface.AddCallBack method This is used to call relevant ActionScript method as a response to JavaScrirpt method calling Eg :- ExternalInterface.AddCallBack (“ callFromJS”,”Actual ActionScript Function”); Action Script JavaScript Communication
In order to test flash objects in web applications a middle ware is needed to provide this inter communication. To send testing parameters to Flash objects and retrieve the results. Finding out such tools and configure them with the existing framework is essential to flash testing Therefore..
Flash testing using Flash Selenium White box testing. we need to know about the internal coding of the Flash application in order to perform the test. Compatible with the Selenium RC and Web Driver. Selenium IDE cannot be used. Flash UI components are identified by specific id called Flash Object ID which is equivalent to the XPATH of the HTML elements.
Flash testing using Flash Selenium
Steps Obtain Flash object as .swf file or .mxml file. If the file is in .swf format decompile using a De-compiler. Obtain the Action Script code or the mxml code and analyze it using Adobe Flex Builder. Add External interface class to the project and define functions which wraps the internal functions which should be tested. These functions should map the external Java Script calling methods with the Action Script internal methods. Flash testing using Flash Selenium
Recompile the file to obtain the swf file test the Flash object using Selenium RC as follows. public void testColorTransition () { assertEquals ("Clicking Colors", browser.getTitle ()); assertEquals (GREEN, flashseleneium.call (" getColor ")); flashseleneium.call ("click"); assertEquals (BLUE, flashseleneium.call (" getColor ")); flashseleneium.call ("click"); assertEquals (RED, flashseleneium.call (" getColor ")); flashseleneium.call ("click"); assertEquals (GREEN, flashseleneium.call (" getColor ")); } Flash testing using Flash Selenium
Flex UI selenium can be used to test Flash UI components instead of its functions. Every UI component is identified by its Flash object ID. Flex UI selenium library should be added to the build path of the Flash/Flex File in order to communicate with the Flex UI and Flash Selenium Libraries. Flash testing using Flex UI Selenium
Obtain Flash object as .swf file or .mxml file. If the file is in .swf format decompile using a De-compiler. Obtain the Action Script code or the mxml code and analyze it using Adobe Flex Builder. Extract and analyze the Flash object ids of UI components of the application. Add FlexSelenium.swc to the build path and recompile the file using Adobe Flex SDK. Write test cases against the UI components and their Functionalities using selenium RC. Steps..
public void testFlashCal (){ try { Thread. sleep (4000); //---------- Following part is for test using the Flex UI Selenium part flexUi.type ("50").at("num"); flexUi.type ("2").at("factor"); // flexUi.type ("2").at("factor"); Thread. sleep (500); assertEquals ("The result is 100",flexUi.readFrom("result")); for (int i = 1; i <=10 ; i++) { flexUi.click ("button"); Thread. sleep (500); if( i ==1){ assertEquals ("pushed "+ i +" time" , flexUi.readFrom (" buttonClicks ")); } else{ assertEquals ("pushed "+ i +" times" , flexUi.readFrom (" buttonClicks ")); } Thread. sleep (500); } flexUi.click (" comboQuote "); assertEquals ("" , flexUi.readFrom (" buttonClicks ")); Examples..
No single IDE to configure all of above configurations. Because of the multiple software components and multiple versions. Time consuming Flex –UI selenium is still in its development stage and not compatible with eclipse higher versions. Internal Action Script / Flex codes should be understood by the tester. For the MIT BBO application, they are using ADF faces technology where the flash application independently connected with the server to obtain data. Drawbacks..
Newest addition to the Flash UI testing. Equivalent to the Selenium Framework. Compatible with Eclipse Higher versions (3.5.0 etc). Support UI component testing using inbuilt IDE. UI components are captured by the accessing internal ActionScript code of the Flash object. Every component is uniquely identified by an Id called Genie ID. Genie FrameWork
Completely written in Java. Therefore can be integrated with the existing Testing Framework. Provide in-built functions to capture Flash UI components. Available as a plug-in for Eclipse. Test scripts can be generated using Java. Complete API is available. Genie FrameWork
No instrumentation or application manipulation is required. Automate pure ActionScript 3.0 SWF. No source code access required. No need to run inside any wrapper. Works on web based apps and standalone SWF. Performs native automation (no image dependency) thus making scripts reliable and lowering down maintenance cost. Application can even be running in background. Features of Genie Framework
Dynamic and static content can be tested. Each and every Flash component is uniquely identified using the Genie id. Features of Genie Framework