使用QTP的.NET插件扩展技术测试ComponentOne的ToolBar控件

qtp .net 插件 qtp .net 插件 c# 立即下载

对于ComponentOne的ToolBar控件,我们可以采用QTP的.NET插件扩展技术来处理。下面是在VS.NET2005中编写的插件扩展代码:

using System;

using Mercury.QTP.CustomServer;

using System.Windows.Forms;

using QuickTestCustomServer_C1ToolBar;

using C1.Win.C1Command;

 

namespace QuickTestCustomServer_C1ToolBar

{

    [ReplayInterface]

    public interface IC1ToolBarReplay

    {

        #region Wizard generated sample code (commented)

        //          void  CustomMouseDown(int X, int Y);

        #endregion

        void C1ToolBar_Click(string text);

    }

    /// <summary>

    /// Summary description for C1ToolBar.

    /// </summary>

    public class C1ToolBar :

        CustomServerBase,

        IC1ToolBarReplay

    {

        // You shouldn't call Base class methods/properties at the constructor

        // since its services are not initialized yet.

        public C1ToolBar()

        {

            //

            // TODO: Add constructor logic here

            //

        }

 

        #region IRecord override Methods

        #region Wizard generated sample code (commented)

        /// <summary>

                   /// To change Window messages filter implement this method.

                   /// The default implementation is to get only Control's window messages.

                   /// </summary>

        //public override WND_MsgFilter GetWndMessageFilter()

        //{

        //    return WND_MsgFilter.WND_MSGS;

        //}

       

        /*

                   /// <summary>

                   /// To catch window messages you should implement this method.

                   /// Please note: This method is called just in case the CustomServer is running

                   /// under QuickTest process.

                   /// </summary>

                   public override RecordStatus OnMessage(ref Message tMsg)

                   {

                            // TODO:  Add OnMessage implementation.

                            return RecordStatus.RECORD_HANDLED;

                   }

        */

        #endregion

        /// <summary>

        /// In case you extend Record process, you should add your Events handlers

        /// in order to listen to Control's Events.

        /// </summary>

        public override void InitEventListener()

        {

            #region Wizard generated sample code (commented)

            /*                    // Notice, You can add as many handlers as you need.

                            // Adding OnMouseDown handler.

                            Delegate  e = new System.Windows.Forms.MouseEventHandler(this.OnMouseDown);

 

                            // Adds an event handler as the first handler of the event.

                            // The first argument is the name of the event for which to listen.

                            //         You must provide an event that the control supports.

                            //         Use the .NET Spy to obtain the list of events supported by the control.

                            // The second argument is the event handler delegate.

 

                            AddHandler("MouseDown", e);

*/

            #endregion

                       

            //Delegate e = new C1.Win.C1Command.ClickEventHandler(this.oControl_Click);

            //AddHandler("Click", e);

 

            C1.Win.C1Command.C1ToolBar oControl = (C1.Win.C1Command.C1ToolBar)SourceControl;

 

            for (int i = 0; i < oControl.CommandLinks.Count; i++)

            {

                oControl.CommandLinks[i].Command.Click += new C1.Win.C1Command.ClickEventHandler(this.oControl_CommandClick);

            }

        }

       

        /// <summary>

        /// At the end of the Record process this method is called by QuickTest to release

        /// all the handlers the user added in InitEventListener method.

        /// Please note: Handlers added via QuickTest methods are released by QuickTest infrastructure.

        /// </summary>

        public override void ReleaseEventListener()

        {

            //C1.Win.C1Command.C1ToolBar oControl = (C1.Win.C1Command.C1ToolBar)SourceControl;

            //oControl.Click -= new

            //C1.Win.C1Command.ClickEventHandler(oControl_Click);

        }

 

        #endregion

 

        #region Record events handlers

        #region Wizard generated sample code (commented)

        /*                   public void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs  e)

                   {

                            // Record line in QTP.

                            if(e.Button == System.Windows.Forms.MouseButtons.Left)

                            {                          

                                     RecordFunction( "CustomMouseDown", RecordingMode.RECORD_SEND_LINE, e.X, e.Y);

                            }

                   }

*/

        #endregion

 

        private void oControl_CommandClick(object sender, C1.Win.C1Command.ClickEventArgs e)

        {

            C1.Win.C1Command.C1ToolBar oControl = (C1.Win.C1Command.C1ToolBar)SourceControl;

            //oControl.CommandLinks[0].State.ToString()

            base.RecordFunction("C1ToolBar_Click", RecordingMode.RECORD_SEND_LINE, e.CallerLink.Text);

            //C1.Win.C1Command.C1ToolBar oControl = (C1.Win.C1Command.C1ToolBar)SourceControl;

            //// Add a step in the test for the test object with the ClickButton method

            //// and the tooltip text as an argument

            //base.RecordFunction("ClickButton", RecordingMode.RECORD_SEND_LINE, e.CallerLink.Text);

        }

 

        #endregion

 

        #region Replay interface implementation

        #region Wizard generated sample code (commented)

        /*                   public void CustomMouseDown(int X, int Y)

                   {

                            MouseClick(X, Y, MOUSE_BUTTON.LEFT_MOUSE_BUTTON);

                   }

*/

        #endregion

 

        public void C1ToolBar_Click(string text)

        {

            //MessageBox.Show("Test!");

            C1.Win.C1Command.C1ToolBar oControl = (C1.Win.C1Command.C1ToolBar)SourceControl;

            //Find the correct item in the toolbar according to its tooltip text.

            for (int i = 0; i < oControl.CommandLinks.Count; i++)

            {

                //Found the correct ButtonItem

                if (oControl.CommandLinks[i].Text == text)

                {

                    //base.ReplayReportStep("Find",EventStatus.EVENTSTATUS_GENERAL,text);

                    if (oControl.CommandLinks[i].Command.IsParent == true)

                    {

                        System.Drawing.Rectangle oRect = oControl.CommandLinks[i].Bounds;

                        int x = oRect.X + oRect.Width - 2;

                        int y = oRect.Y + oRect.Height/2;

                        //Click the middle of the button item

                        base.MouseClick(x, y, MOUSE_BUTTON.LEFT_MOUSE_BUTTON);

                    }

                    else

                    {

                    // Retrieve the rectangle of the button's boundaries and

                    // locate its center

                   

                    //System.Drawing.Rectangle oRect = oControl.CommandLinks[i].CheckRect;

                    System.Drawing.Rectangle oRect = oControl.CommandLinks[i].Bounds;

                    int x = oRect.X + oRect.Width / 2;

                    int y = oRect.Y + oRect.Height / 2;

                    //Click the middle of the button item

                    base.MouseClick(x, y, MOUSE_BUTTON.LEFT_MOUSE_BUTTON);

                    }

                    break;

                }

            }

            base.ReplayReportStep("C1ToolBar_Click", EventStatus.EVENTSTATUS_GENERAL, text);

          }

       

        #endregion

    }

}

 

 

把如下XML代码插入到QTP安装目录中的dat目录下的SwfConfig.xml文件中(注意修改DLL的文件路径):

<!-- Merge this XML content into file "<QuickTest Professional>/dat/SwfConfig.xml". -->

  <Control Type="C1.Win.C1Command.C1ToolBar" >

    <CustomRecord>

      <Component>

             <Context>AUT</Context>

        <DllName>D:/QTP_dotNET/ComponentOne/ToolBar/QuickTestCustomServer_C1ToolBar/QuickTestCustomServer_C1ToolBar/bin/QuickTestCustomServer_C1ToolBar.dll</DllName>

        <TypeName>QuickTestCustomServer_C1ToolBar.C1ToolBar</TypeName>

      </Component>

    </CustomRecord>

    <CustomReplay>

      <Component>

             <Context>AUT</Context>

        <DllName>D:/QTP_dotNET/ComponentOne/ToolBar/QuickTestCustomServer_C1ToolBar/QuickTestCustomServer_C1ToolBar/bin/QuickTestCustomServer_C1ToolBar.dll</DllName>

        <TypeName>QuickTestCustomServer_C1ToolBar.C1ToolBar</TypeName>

      </Component>

    </CustomReplay>

<!--<Settings>

       <Parameter Name="sample name">sample value</Parameter>

    </Settings> -->

  </Control>

 

 

这样,启动QTP之后,就可以直接使用QTP的录制功能来录制和产生ComponentOne的ToolBar控件脚本了,例如:

SwfWindow("New document").Activate

SwfWindow("New document").SwfObject("SwfObject").C1ToolBar_Click "&New"

SwfWindow("New document").SwfObject("SwfObject").C1ToolBar_Click "E&xit"

 

qtp8.2.net插件第二部分 qtp8.2.net插件第二部分,由于我本人的上传权限有限所以只能分成两部分上传,请大家下载完前一部分再下载这一部分,要不然用不成,希望大家多多支持,谢谢! 立即下载

相关推荐

qtp各种插件

介绍了qtp的各种常用的插件,有比较详细的说明

【转载】VS中安装QT扩展插件

VS中安装QT扩展插件 1. 安装qt软件 QT下载网址(各版本). QT(5.12.11)直达界面. 根据操作系统不同,选择相应版本下载 双击运行…输入QT账号信息,没有需要注册一个 安装时须勾选MSVC 2017 64-bit,若用32位,则选32-bit 安装后,打开QT软件(…\Qt5.12.11\Tools\QtCreator\bin\Qt Creator.exe),可在 工具->选项->Kits->QT Versions 中看到两个编译器 自带编译器MinGW + MSVC2

weixin_41985687的博客 7628

[小梅哥FPGA] 如何通过动态重配置实现FPGA时钟的实时频率/相位/占空比调整?

PLL和MMCM是实际存在的硬件电路,用以对输入时钟的负面变化,如抖动、频率变化、相位偏移、占空比失真等进行处理。基于该表,用户在初始化Clk_Wiz后,只需要计算好所需的频率、相位、占空比对应的设置值,使用Xil_Out32函数配置对应寄存器即可。通过上述步骤,在平时的开发调试过程中,亦或是一些对于时钟可能有着实时性要求的设计(如数据采集、图像处理)里,我们便可以在无需重新修改设计的前提下,通过AXI4总线来完成对时钟频率、相位的调控,从而达到缩短设计周期以及让设计适应更多场景的目的。

zgmxs的专栏 2492

QTP .net插件

<br />       QTP默认安装完后支持ActiveX、Visual Basic、Web三种类型,对.net不支持,录了半天一个控件都没有识别出来,查了下才发现如果要对.net支持就要安装插件,在网上搜了好久都搜不到,后来直接到官网上寻找下载了一个<br />    <br />    大家可以到惠普下载中心https://h10078.www1.hp.com/cda/hpdc/display/main/index.jsp?zn=bto&cp=54_4012_100__,在keywords中输入 "

casilin的专栏 5139

避坑指南:STM32CubeMX配置USB虚拟串口时Heap Size设置的那些坑

本文深入剖析了使用STM32CubeMX配置USB虚拟串口时,因Heap Size设置不当导致设备无法识别的常见问题。文章从故障现象出发,详细解释了堆内存不足如何影响USB枚举过程,并提供了从内存布局分析、动态监控到系统化调试的完整解决方案,帮助开发者从根本上避免这一配置陷阱。

ttt77的博客 599

从零到一:华为iMaster NCE-Campus部署中的Euler OS与FusionInsight深度解析

本文深入解析华为iMaster NCE-Campus部署中Euler OS与FusionInsight的关键技术要点,包括RAID配置、网络绑定技术、安装避坑指南及性能调优方案。通过实战经验和详细配置示例,帮助工程师提升部署效率与系统稳定性,确保华为企业级解决方案的高效运行。

f6g7h8i9j的博客 547

qtp .net,java,webservices插件下载、安装、破解(转)

1.插件下载 QTP 9.2 http://esd.mercury.com/akdlm/trial/qtp/qtp92.zipQTP相关的插件http://esd.mercury.com/akdlm/trial/qtp/qtp92-net-addin.ziphttp://esd.mercury.com/akdlm/trial/qtp/qtp-java-addin.ziphttp://esd.me...

weixin_30651273的博客 143

安时积分法和开路电压法结合估算锂电池SOC

基于安时积分法和开路电压法结合的锂电池SOC估计Simulink仿真建模,利用安时积分法计算放电过程中的SOC,在搁置状态利用开路电压法进行SOC修正。

qq_39304296的博客 2552

QTP-C/S客户端功能自动化测试

目的:该CS客户端系统已经比较稳定,后期的维护性测试只是小部分功能的新增或者修改,每次维护性测试如果将所有的功能都过一遍花费时间太多,但是不测试一遍的话,总会有些功能被开发修改后出现明显错误,目的是在每次维护性项目时将软件基础功能进行自动化测试,保证基础功能的正确性,节省测试时间。 客户端为为C/S,.net平台,WPF框架,采用c#编程, 测试准备条件: l下载安装QTP11,安装时会提...

与君共勉 1万+

Workbench中直接调用ICEM CFD进行网格划分

自从ANSYS 12.0之后,ICEM CFD就从Workbench中被分离出去,作为一个独立的程序使用了。取而代之的是Meshing模块。 在Meshing的属性节点菜单中右键点击Mesh,选择Insert > Method,插入方法。 选择需要划分网格的几何体,点击apply。此时Geometry显示为1 Body。 设置Method为MultiZone,如果不设置成这个的话,找不到进入ICEM CFD的入口。如果要划分四面体,可以在Mapped Mesh Type中选择其他类型。

Yan的博客 6510

Ubuntu22.04中通过conda快速部署PyTorch开发环境(CPU/GPU双版本实战)

本文详细介绍了在Ubuntu22.04系统中,如何利用Conda高效部署PyTorch开发环境。文章分别提供了CPU与GPU双版本的实战教程,涵盖环境创建、镜像加速、版本匹配及深度验证等关键步骤,旨在帮助开发者快速搭建稳定、兼容的深度学习环境,从而专注于模型开发。

rose2的博客 555

QTP测试WinToolbar控件

Windows的通知区域(通常是QQ这类软件最小化时所在的区域)不能被QTP所录制,但是QTP是可以识别出来这个区域的对象的 - WinToolbar 可以通过WinToolbar 的GetItemsCount方法获取到Windows通知区域显示的按钮个数,通过GetItem方法可以获取到按钮的文本,这样就可以通过这些文本来一个个比较,找出需要点击的按钮。最后通过Press方法执行按键操作

软件质量优化 4377

SerDes电路的PCB仿真设计规则及策略

SerDes的PCB设计中,重点工作是使用3D 电磁 (EM) 场求解器,进行过孔结构优化,包括 BGA的扇入和扇出区域以及布线的过孔区域,并且,利用连接器供应商提供加密的 3D 模型,进行连接器和 PCB 的级联仿真,最终获取系统级的通道性能参数,如插入损耗、回波损耗、串扰和模式转换、阻抗曲线等,如果发现任何缺陷,再进行进一步优化,这一过程中,推荐进行拆分仿真,以提高设计效率。

一只豌豆象的博客 2190

C语言 switch-case 与 if-else 性能对比:基于ARM Cortex-M3的10万次循环测试

本文基于ARM Cortex-M3架构,通过10万次循环测试对比了C语言中switch-case与if-else的性能差异。测试结果显示,随着分支数量增加,switch-case在性能上展现出显著优势,最高可达59%的速度提升。文章还提供了针对不同分支数量的选型建议、编译器优化技巧以及实际工程中的性能陷阱规避方法,为嵌入式开发人员提供了实用的优化指南。

weixin_33951761的博客 696

数控系统(CNC)系列:Fanuc 31i-B_(16).CNC系统的网络连接与数据传输

硬件连接:包括网络接口的类型、连接方式等。网络协议:常用的网络协议包括Ethernet、Modbus TCP、Profinet等。网络配置:如何在CNC系统中配置网络参数,使其能够正确接入网络。在网络化的现代工业生产环境中,CNC系统的网络连接和数据传输能力变得越来越重要。通过以太网、Modbus TCP和Profinet等网络协议,可以实现CNC系统与上位机、其他CNC系统以及各种工业设备之间的高效通信。

2401_87715305的博客 2433

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

QTP测试Flex页面的步骤

QTP测试Flex页面的步骤 2010年09月28日   需要的环境:   1、QTP9.2版本。   2、Flex3.2版本。   3、Flex plugin for qtp只支持IE6及以上版本。   4、必须安装flash player 9.0.28或以上版本。   一、安装QTP9.2程序。   二、安装 Flex Builder 3 Plug-in,在其...

tha841nc 167

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

QTP与Selenium的比较

1、用户仿真:Selenium在浏览器后台执行,它通过修改HTML的DOM(文档对象模型)来执行操作,实际上是通过javascript来控制的。执行时窗口可以最小化,可以在同一机器执行多个测试。QTP完全模拟终端用户,独占屏幕,只能开启一个独占的实例。TestComplete和qtp类似。   2、UI组件支持:selenium 支持主要的组件,但是某些事件、方法和对象属性支持不够,QTP提供

Ethon自动化测试 5236

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

QTP(UFT)的扩展插件在chrome上使用

目前使用HP提供的EA工具自定义的UFT插件,不能工作在chrome上面。 而项目又确实需要在chrome上面跑 UFT操作chrome浏览器,必须在chrome上面加载一个扩展。 看了UFT加载在chrome的扩展内容。实际上是一些和UFT交互的js。 UFT操作chrome的动作全都由chrome扩展上面的js完成。 所以,可以通过修改chrome扩展来实现自定义的UFT插件...

weixin_30876945的博客 1025

QTP11不能识别.NET对象的解决方法

在QTP中,.NET对象的Class Name都是以Swf开头的,使用QTP11测试.NET程序时经常出现无法识别对象,将窗口识别成Window而不是SwfWindow的情况,导致测试不能正常进行下去,下面给出三种解决方法,如果还不行的话,只能重装QTP了。   1、安装QTP的.NET插件,启动QTP时选择.NET插件,其他插件不选,以免有冲突; 2、安装QTP11补丁QTP_00709....

smmi的专栏 361

Winform开发框架之Office Ribbon界面

在前面几篇文章介绍我的Winform框架随笔文章,包括有《Winform开发框架之字典数据管理》、《Winform开发框架之权限管理系统》、《Winform开发框架之终极应用》,其中Winform开发框架之终极应用是集众多功能与一身,提供综合一站式、整体性的传统应用系统的开发框架,在此基础上开发新的业务系统,开发工作则是事半功倍,而且提供了高效、统一的界面布局以及支持多种数据库的数据访问层支持,提...

weixin_34307464的博客 1187
上一篇: QTP测试.NET控件CheckedListBox
下一篇: 用上帝之眼进行自动化测试
TIB
TIB
博客等级 码龄19年 2879粉丝 957原创
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值