MACROMEDIA FLEX 2-TESTING FLEX APPLICATIONS WITH MERCURY QUICKTEST PROFESSIONAL Applications

Summary of FLEX 2-TESTING FLEX APPLICATIONS WITH MERCURY QUICKTEST PROFESSIONAL

  • Page 1

    Testing flex applications with mercury quicktest professional ad ob e ® fl ex ™ 2.

  • Page 2

    © 2007 adobe systems incorporated. All rights reserved. Testing flex™ applications with mercury quicktest professional™ if this guide is distributed with software that includes an end-user agreement, this guide, as well as the software described in it, is furnished under license and may be used or c...

  • Page 3

    3 contents chapter 1: working with quicktest professional . . . . . . . . . . . . . . 5 introduction to the testing process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 deploying flex files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 a...

  • Page 4

    4 contents.

  • Page 5

    5 1 chapter 1 working with quicktest professional this topic describes how to work with mercury quicktest professional™ and adobe flex applications. Contents introduction to the testing process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 test creation over...

  • Page 6

    6 working with quicktest professional before you can test a flex application, a flex developer compiles a swf file for you. The developer also provides you with an html file that embeds the swf file in it. This is known as the html wrapper. You deploy these two files to any web server. Some flex app...

  • Page 7

    Introduction to the testing process 7 about the flex installed testing files the flex support for qtp requires that you install two activex plug-ins on the testing machine. These plug-ins provide the necessary communication layer between flex and qtp. One plug-in runs inside of qtp, and the other ru...

  • Page 8

    8 working with quicktest professional test creation overview when you record a test, qtp records the lines of the test script correlating to each action that you performed. Each line typically represents an action that you carried out on a component that appears on the screen. Those components are c...

  • Page 9

    Test creation overview 9 operations are actions that you perform on objects. They are equivalent to a flex event, but are generally at a higher level. For example, when you click on a button, qtp records a “click” operation. Qtp does not record the mousedown and mouseup events, which essentially mak...

  • Page 10

    10 working with quicktest professional the following example shows a flex button control in the qtp repository editor: when you run a test and interact with a flex control, qtp does the following: 1. Identifies the test object class that your flex object maps to. 2. Reads the current state of the ob...

  • Page 11

    Test creation overview 11 about the application hierarchy in the object repository, objects are stored in a hierarchy. The root of the hierarchy is the browser. The next element is the flex application. Under that are the containers and controls that make up the application. In the qtp object reposi...

  • Page 12

    12 working with quicktest professional recording tests to record a test in qtp, you must compile the application’s swf file and generate the html wrapper files. The main wrapper file defines the application as an object on the page and embeds it so that flash player is invoked when the page is reque...

  • Page 13

    About the testing script 13 when you play back the test, qtp opens the browser and requests the same url. Be sure to specify an html file or other wrapper file type that embeds the application’s swf file. You should not request the swf file directly. About the testing script qtp records the test in ...

  • Page 14

    14 working with quicktest professional the operation property is the event dispatched by the object that qtp records. This property can take zero or more parameters. The number and type of parameters depend on the type of control that is dispatching the event. They can be a key that was held down du...

  • Page 15

    About operations 15 if the flexbutton object has no label, qtp uses the tooltip of the button for the test object name. If there is no label and no tooltip, qtp uses the source code’s id property. If the flex developer did not specify an id , qtp uses the index. If you omit all of these, qtp uses it...

  • Page 16

    16 working with quicktest professional qtp stores a set of parameters for each operation that define aspects of the operation. These parameters include what keys were held down when the mouse was clicked or the x and y position of the target in a drag and drop operation. Operation parameters also re...

  • Page 17

    Using checkpoints 17 using checkpoints checkpoints let you examine objects and fail or pass the test based on whether the object contains the value you expected. During the test, qtp compares the current value against the expected value in the checkpoint. If the values do not match, then the test fa...

  • Page 18

    18 working with quicktest professional bitmap checkpoints when using bitmap checkpoints, ensure that you account for differences in the appearance of flex objects. These differences can be due to tab focus on a test object or to the object’s reaction to a mouseover event. If you add a bitmap checkpo...

  • Page 19

    Playing back flex tests 19 you can use the common methods and properties in the keyword or expert views. The following example uses the checkproperty() method to check whether the visible property of the mylist control is set to false in expert view: browser("my page").Flexapplication("myapp").Flexc...

  • Page 20

    20 working with quicktest professional.

  • Page 21

    21 2 chapter 2 advanced concepts this topic describes advanced concepts when using mercury quicktest professional to test flex applications. Contents working with containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 working with repeater...

  • Page 22

    22 advanced concepts working with repeater objects repeater objects are visible in the qtp object hierarchy and scripts, and contain the child objects that they have created. In an actual flex application, these child objects are children of the main container and not the repeater object. In qtp tab...

  • Page 23

    Troubleshooting 23 if qtp does not record interactions with your flex application, you should try to determine if the plug-in is installed. The following problems are the most common: ■ flash player is not the right version. ■ internet explorer is not the right version. ■ internet explorer has plug-...

  • Page 24

    24 advanced concepts 3. Run miclogsetting.Exe. The miclogsetting dialog box appears: 4. From the level drop-down list, select miclogleveldebug2 as the level. 5. In the folder field, select a folder where the log file is saved. 6. From the available categories list, select logcatpacktea, and click th...

  • Page 25

    Troubleshooting 25 ■ your scripts are failing in a spot where they should not be. There are several solutions to these timing issues, which are described in the following sections. Adding waits to scripts you can use the wait statement to pause a script’s playback for any number of seconds. You pass...

  • Page 26

    26 advanced concepts 2. In the options dialog box, select the run tab. 3. Select the normal option for the run mode. This is the default option. 4. Increase the amount of the delay each step execution by option to some number of milliseconds. The default value is 0. 5. Click ok to save your changes....

  • Page 27

    Troubleshooting 27 2. In the options dialog box, select the web tab: 3. Increase the amount of the add n seconds to page load time option to a number large enough to ensure that your application compiles before qtp starts running the test. The default value is 10..

  • Page 28

    28 advanced concepts making a test fail but continue to the end you may encounter situations where you cannot make the test fail or pass from a script and still continue to the end. Specifically, this has been reported for tests that change a formula within a data table. To write a qtp method that c...

  • Page 29

    Limitations of automated testing with flex 29 limitations of automated testing with flex the flex integration with qtp includes the following limitations: ■ flex test objects do not show up in the object identification (tools > object identification) dialog box. Therefore, you generally do not confi...

  • Page 30

    30 advanced concepts.