QTP支持flash测试总结-yc

上一篇 / 下一篇  2010-01-21 16:03:55 / 个人分类:QTP

QTP支持flash测试总结-yc

QTP版本:QTP9.2
flex版本:3.2/3.3/3.4


flex builder下载地址:
http://download.macromedia.com/pub/flex/flex_builder/FB3_win.exe

flex(做为eclipse的插件)下载地址:
http://download.macromedia.com/pub/flex/eclipse_plugin/FB3_WWEJ_Plugin.exe?loc=en


下载安装flex后
在D:\Program Files\Adobe\Flex Builder 3\Installers这个目录下,会有QTP_Plugin_Installer.exe这个文件
QTP_Plugin_Installer.exe这个即QTP支持flex的插件,直接双击运行并安装;
验证plugin是否安装好:启动QTP,在Add-ins Manager窗口中出现Flex 3.0.0,即表示QTP已经支持flex;


但并不表示所有flex的项目,QTP都可以录制;
要求flex项目编译时,也要加入一些支持QTP的编译参数;


FLEX BUILDER增加编译参数方法:
1. 打开FB,右键选择你的Project -> Properties -> Flex Compiler
2. 修改属性“Additional compiler arguments”,在该属性中添加如下代码:
-locale en_US -include-libraries "flex_builder_dir\sdks\3.2.0\frameworks\libs\automation.swc" "flex_builder_dir\sdks\3.2.0\frameworks\libs\automation_agent.swc" "flex_builder_dir\sdks\3.2.0\frameworks\libs\qtp.swc" "flex_builder_dir\sdks\3.2.0\frameworks\libs\automation_dmv.swc"
其中flex_builder_dir由Flex Builder的安装目录代替,windows平台的默认安装目录为 "C:\Program Files\Adobe\Flex Builder 3"
3. 编译项目,然后发布应用到你的web server
4. 这时就为QTP的自动化测试做好了准备

 

但如果你使用的是flex sdk 3.3
那么,你会发现你的sdk下面并没有下面这些文件:
automation.swc/automation_agent.swc/qtp.swc/automation_dmv.swc
解决方法:
把下面这些文件从3.2版本目录下,拷到3.3的对应目录下:

C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\libs
datavisualization_rb.swc
automation_rb.swc
automation_agent_rb.swc
这三个文件拷到3.3对应的frameworks\libs目录下

C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\locale\en_US
datavisualization.swc
automation.swc
automation_dmv.swc
qtp.swc
automation_agent.swc
这五个文件拷到3.3对应的frameworks\locale\en_US目录下
flex sdk 3.2版本下的几个文件
flex-3.2.rar(1.14 MB)

flex builder编译参数同3.2版本

如果使用flex sdk 3.3,并增加上述automation swcs编译参数后,出现错误提示:

flash debug提示:
TypeError: Error #1009: 无法访问空对象引用的属性或方法。
        at mx.automation.qtp:: QTPAdapter/setTestingEnvironment()[C:\work\flex\dmv_automation\projects\qtp\src\mx\automation\qtp\QTPAdapter.as:461]
        at mx.automation.qtp:: QTPAdapter()[C:\work\flex\dmv_automation\projects\qtp\src\mx\automation\qtp\QTPAdapter.as:357]
        at mx.automation.qtp:: QTPAgent/applicationCompleteHandler()[C:\work\flex\dmv_automation\projects\qtp\src\mx\automation\qtp\QTPAgent.as:48]
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.managers:: SystemManager/preloader_preloaderDoneHandler()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3025]
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.preloaders:: Preloader/displayClassCompleteHandler()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\preloaders\Preloader.as:434]
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at com.adobe.cairngorm.game.view.loading::AppPreloader/dispatchComplete()[E:\fairylly\CompanySystem\liangjiansanguo\codes\game\src\com\adobe\cairngorm\game\view\loading\AppPreloader.as:100]
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()

这个是因为flex sdk3.3的一个BUG导致的,感谢adobe官网论坛上,svakil的回复:

You are facing the issue mentioned herehttp://bugs.adobe.com/jira/browse/FLEXENT-791
The issue is that when an application has overlapping containers and is compiled using automation libraries the controls present in the lower container are not clickable.

This issue has been resolved in sdk 3.4 but there is also a workaround wherein you can set mouseEnabled property to false for both the overlapping containers and run the application all your buttons should work.

升级flex sdk3.4后,使用对应的automation swcs包,重新编译项目,问题即可解决。
http://download.macromedia.com/pub/flex/sdk/automation_sdk3.4.zip
http://download.macromedia.com/pub/flex/sdk/datavisualization_sdk3.4.zip

automation_sdk3.4.zip(333 KB)

注:必须要加编译参数,不要认为单单加到项目的libs目录下就可以使用,测试表明,有加到libs下但没有增加编译参数,虽然编译通过,但QTP无法录制到内容;

 

 


TAG: FLASH flex QTP

 

评分:0

我来说两句

Open Toolbar