为了让QTP可以识别Flex对象,还需要对被测试的Flex程序进行编译设置,打开Flex Builder,右键选择Project -> Properties -> Flex Compiler,修改属性“Additional compiler arguments”,在该属性中添加:
-locale en_US -include-libraries "C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\libs\automation.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\libs\automation_agent.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\libs\qtp.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\libs\automation_dmv.swc"
这样编译后的Flex程序就可以被QTP所识别了:
功能测试工具 src="https://www.ltesting.net/attachments/2009/07/54376_200907150937445SOa1.jpg"> |
录制的脚本如下所示:
Window("Microsoft Internet Explorer").FlexApplication("PhotoAlbum").FlexLinkBar("_PhotoAlbum_LinkBar1").Change "Shopping Cart"
Window("Microsoft Internet Explorer").FlexApplication("PhotoAlbum").FlexLinkBar("_PhotoAlbum_LinkBar1").Change "Photo Catalog"
Window("Microsoft Internet Explorer").FlexApplication("PhotoAlbum").FlexBox("Photo Catalog").FlexList("slideList").FlexBox("assets/thumbs/alcatraz.jpg").FlexImage("assets/thumbs/alcatraz.jpg").Click
文章来源于领测软件测试网 https://www.ltesting.net/