软件测试外文翻译--GUI自动化测试研究.docx_第1页
软件测试外文翻译--GUI自动化测试研究.docx_第2页
软件测试外文翻译--GUI自动化测试研究.docx_第3页
软件测试外文翻译--GUI自动化测试研究.docx_第4页
软件测试外文翻译--GUI自动化测试研究.docx_第5页
免费预览已结束,剩余8页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

附录1外文译文GUI自动化测试研究摘要:指出了目前自动化测试所采用的录制技术存在的不足,针对不断变化的图形用户界面测试代码很难维护和扩展的问题,采用基于对象的捕捉技术,设计了以Windows消息机制为基础的GU IATF测试框架,实现了高度灵活并易于扩展的图形用户界面自动化测试。关键词:软件测试;回归测试;自动化0引言测试是一种旨在评估一个程序或系统的属性或能力,确定它是否符合其所需结果的活动。在整个软件开发过程中,从需求分析到系统设计直到代码实现,都会出现或多或少的问题。如何保障软件的质量,软件测试就成为关键的技术。软件测试的工作量很大并具有一定的重复性,尤其在测试后期所进行的回归测试中(回归测试在软件出现发展性的改变和修正性改变时运行),需要验证以前发现的问题在新版本中是否解决,大部分测试工作是重复的。实现软件测试的自动化可以使大量的测试程序化地反复执行,不仅节约了大量的劳动力,而且提高了测试效率并保证了测试的质量。1录制技术的不足目前一些录制技术被应用到图形用户界面的自动化测试中,在软件开发周期中,系统需要不断地更新和维护,为了保证测试质量,测试代码对不断变化的系统要有很强的适应能力,换句话说,测试也同样需要维护。测试脚本的录制过程是根据具体的界面和操作进行的,一旦脚本的执行界面发生改变,运行就会出现异常,甚至仅仅是被操作对象位置的改变或图像分辨率的改变都可能会造成图形用户界面自动化测试的失败,因此,基于录制技术的自动化测试维护的代价相当高。另外,脚本录制的过程是固定的,所以脚本的运行会完全按照操作步骤,不具备灵活性。2自动化测试框架的提出在目前的软件测试中,一个备受关注的问题是如何高效地实现图形用户界面的自动化测试,并使测试代码具有很高的灵活性。本文提出了一种基于对象捕捉技术的图形用户界面自动化测试框架GUIATF(Graphics User Interface Automation Testing Framework),为测试人员方便地创建并灵活地维护测试代码提供保证。当用户界面发生变化时,测试代码能很快地进行更新,对用户界面的变化有很强的适应能力。3GUIATF框架的工作原理GUIATF框架的基础是消息机制,通过消息的发送来触发相应的事件。消息的初始接收器必须是窗口对象。Windows消息通常直接由该窗口对象处理。通常产生于应用程序主框架窗口的命令消息被传送到命令传送中描述的命令目标链。GUIATF框架要完成的任务是为测试人员开发自动化测试代码提供功能强大的接口,模拟测试用例中定义的用户操作,通知系统发送一系列的消息给应用程序,实现测试用例的自动化运行。3.1 GUIATF的作用图1 GUIATF的作用从图1可以看出GUIATF将消息发送给系统,系统响应消息之后通知应用程序来触发对应的事件,完成测试用例中定义的一系列用户操作。GUIATF是连接应用程序和用户操作的桥梁。在自动化测试过程中,测试用例是批量运行的,为了跟踪测试结果,GUIATF需要不断记录执行过程、探测不期望出现的事件以及在运行异常时保存现场截图。这些结果数据通过日志管理存储在日志数据库中,便于测试人员查看和分析测试结果。3.2 GUIATF的结构GUIATF框架由四个模块构成:对象定位、字符转换、消息发送和日志记录,如图2所示。对象定位模块将用户要操作的控件对象转化为GUIATF框架自身定义的自动化对象,然后再对其定位,在定位过程中,需要获取控件的一些属性信息,最常用到的是控件显示在界面上的名称。在不同的语言版本中,同一个控件的名称是不同的,字符转换模块提取当前环境的语言类型,将要检索的控件名称转换为当前语言环境中对应的名称,发送给对象定位模块。对象定位成功后,消息发送模块将模拟用户操作的消息发送到被锁定的对象,比如:用鼠标点击被定位的按钮或在被定位的编辑框中录入信息等。在以上三个模块执行的过程中,日志跟踪模块分别记录它们工作的详细信息,以便自动化测试运行结束后,测试人员通过查看日志信息分析测试结果。图2 GUIATF的结构(1)对象定位模块对象定位模块使GUIATF框架在处理控件对象方面具备功能丰富的接口,测试人员通过调用它们可以方便、高效地实现自动化对象的创建、检索自动化对象包含的子对象、激活对象、确定对象角色、状态和位置等功能。应用程序中的每一个控件都属于主窗口中的子窗口,包括按钮、编辑框等,它们都是Windows系统中的窗口。每个窗口都有一个窗口句柄作为其在系统中的唯一标识,对象定位模块通过获取窗口句柄将其转化为自身定义的自动化对象,主要定义如表1所示。表1 对象定位模块主要成员函数及属性成员函数及属性功能Public Constructor(stringName)根据空间名称创建自动化对象internal bool CheckForUnexpected Window()检测不期望弹出的窗口Public AllSearch FindAllChildren( string FindName)检索所有子对象PublicWinObj FindChild(Roles FindRole)检索某个制定的子对象Public bool VerifyChildDoesNotExist(Roles FindRole)验证子对象不存在Public int ChildCountget;自对象数量(属性)Public intWindowHandleget;对象窗口句柄(属性)Public string Stateget;对象状态(属性)Public Roles Roleget;对象角色(属性)Public Rectangle Positionget;set;对象位置(属性)(2)字符转换模块字符转换模块实现了GUIATF框架跨语言自动化测试的能力。它将自动化对象的属性信息动态转换为当前语言环境下对应的表现形式。在应用程序中存在的每一个字符串都有一个ID值,唯一地标识该字符串的含义,我们把它称为键(KEY),对于一个键,可以对应多个值(VALUE),每一个值代表一种语言的表现形式。应用程序中包含的所有字符串组成一个键的集合,这个键集合对应了多个值集合,每一个值集合相当于一个语言包。比如:我们将一个英文版的应用程序汉化的过程就是用中文语言包中的汉语将英文替换。图3 字符转换过程使用GUIATF 框架提供的接口查找控件对象时,要实现跨语言就不能使用控件对象在一种具体语言下的名称,而要通过此名称的ID 号,也就是键(KEY),根据所获取当前语言环境的类型,动态转换对应的字符表现形式。转换过程如图3所示:在得到要转换字符串的ID值之后,首先确认数据库的配置参数,包括存放数据库的服务器名称,数据库名称,当前语言类型和格式等,然后创建与数据库的连接,把要查找的语言类型和字符串作为参数传递给查询命令,执行查询就可以获取我们需要的转换结果。(3)消息发送模块自动化对象定位之后,消息发送模块提供相应的接口将消息发送给系统,系统响应后通知应用程序触发自动化对象执行对应的事件。在这个模块中,主要封装了鼠标消息类型、键盘消息类型以及消息发送的控制逻辑。鼠标消息类型根据用户使用它的行为定义,包括左键单击、左键双击、右键单击和拖动。Define moduleMouseMessagepublic boolDragAndDrop (WinObj From, WinObj To) ;publicWinObj GetPopupMenu ( ) ;public void LeftClick ( ) ;public void LeftDoubleClick ( ) ;public voidMove ( Point Pos) ;public void RightClick ( ) ;键盘消息类型定义了单键的按下、弹起,多键的选择,字符串的录入以及功能键对自动化对象的控制。Define module KeyBoardMessagepublic void KeyDown (Keys Key) ;public void KeyUp (Keys Key) ;public void Type (Keys KeyArray) ;public void Type ( string Text) ;public bool Type (WinObjWObject, Keys Key) ;public bool Type (WinObjWObject, Keys KeyArray) ;图形用户界面的操作效率受机器性能的影响,当需要点击某个对话框的一个按钮时,向系统发出打开对话框的消息要等待响应,在不同的机器或环境中,响应的时间是不一样的,如果对话框没有出现就触发点击按钮的消息会导致操作的失败,因此,消息的发送需要一定的控制逻辑来协调,包括:根据用户界面状态的变化判断用户进程何时失效,确保相关消息响应之后触发对应操作的执行。主要定义如下所示:Define module ControlLogicpublic boolWaitProcessIdle (WinObjWObject) ;public bool StateChange (WinObjWObject, States State, ) ;publicWinObjWaitDialogBox( string NameStartsWith) ;publicWinObjWaitWindow ( string NameStartsWith) ;publicWinObjWaitMessageBox( string NameStartsWith) ;(4)日志记录模块在测试用例的批量自动化运行过程中,日志记录不仅需要包含测试用例的执行细节,而且还要提供测试用例执行的环境、时间、次数和状态等信息,这些信息都是测试用例管理器负责的。GUIATF框架的日志记录模块通过调用测试用例管理器提供的接口实现日志的存储和查询。4GUIATF框架的优势(1)方便测试用例的创建和修改:GUIATF框架的设计思想是基于对象捕捉的,只要被操作对象存在于用户界面中,即使位置或图像分辨率发生变化,测试代码会根据对象的特征进行准确地定位并对其操作。(2)详细的运行日志:提供详细、准确的运行日志并检测不期望弹出的对话框,保存错误现场的截图,使测试人员快速地定位存在的错误。(3)语言中立:提供测试代码的多语言支持,一份测试代码可以成功地运行在多语言环境中,完美地实现了自动化测试的跨语言能力。5结束语GUIATF框架提供了功能丰富的接口,大大提高了用户界面自动化测试代码的开发效率。测试人员通过调用GUIATF框架提供的功能可以高效、灵活地实现测试逻辑,不会像录制技术那样因为测试脚本的固定使得测试很难维护。在模拟多用户的并发操作中,GUIATF框架在实现多机并发操作中还存在一定的不足,目前虽然实现了多机进程间的通讯和同步,但是和测试用例管理器还没有建立连接,没有实现并发测试批量运行日志的统一管理。另外,多机运行并发测试在调试方面也比较复杂,对调试技巧有很高的要求,在下阶段的工作中将对其进行重点研究。附录2外文原文Research on GUI Automation Testing25Abstract: This paper points out the obvious deficiencies of recording technique in testing automation at present, aiming at constantly variational GUI , adopts objectoriented cap turing technique , designs GU IATF framework based on Windows message mechanism and imp lements GUI automation testing , largely imp roved agility of automation testing.Key words: software testing; regression testing; automation0.IntroductionIs a test designed to assess a program or system attributes or the ability to determine whether it meets the required results of its activities. In the entire software development process, from needs analysis to the system design until the realization of the code, there will be more or less the issue. How to protect the quality of software, software testing has become the key technology. Software testing the heavy workload and has a repetitive, especially in the latter part of tests conducted by the regression testing (regression testing in the development of software changes and amendments to change when running), the need to verify before the problems identified in the new version In the solution, most of the tests are repeated. Implementation of the automated software testing can make a lot of testing procedures and implementation of repeated, not only saving a lot of labor, but also improve the efficiency of testing and quality assurance testing.1.The lack of recording technologyAt present, some recording technology has been applied to the graphical user interface of the automated test, in the software development cycle, the system needs to constantly update and maintain, in order to guarantee the quality of testing, testing code to changing the system have a strong sense of adaptability to change Saying that the test is also the need to preserve. Test script recording process is based on the specific operation of the interface and, once the script of the implementation of the interface change, there will be abnormal operation, or even just be operating targets or change the location of the image resolution of the changes may result in graphical user The failure of automated testing interface, therefore , based on the recording of the cost of maintaining automated test is quite high. In addition, the script of the recording process is fixed, so the script will run in full accordance with the steps, and do not have flexibility.2.Automated test framework of the proposedIn the current software testing, one area of concern is how to achieve efficient graphical user interface of the automated test , and test code with high flexibility . This paper presents a target capture technology - based graphical user interface automated test framework GUIATF ( Graphics User Interface Automation Testing Framework ) , for the test easily create and maintain flexibility in the testing code to provide guarantee . When the user interface changes , test code can be quickly updated , the changes in the user interface has a strong adaptability.3.GUIATF framework of the working principleGUIATF framework is based on the information mechanism, the message sent through the appropriate incident to trigger . The initial news receiver must be the window object . Windows message usually directly targeted by the window treatment . Application procedures are usually produced in the framework of the main window to order message sent to transmit an order described in the order linked objectives . GUIATF framework to complete the task is to test the development of automated test code provides a powerful interface , simulation test case in the definition of user actions , the notification system sent the message to a series of applications , and automated test case run.3.1The role of GUIATFFigure 1 GUIATF roleCan be seen from Figure 1 GUIATF will send a message to the system , the system response to the news notification application to trigger the corresponding events , completed a series of test cases in the definition of user actions. GUIATF is connected applications and user operation of the bridge . In the automated testing process , the test case is the bulk of the running , in order to track tes results , GUIATF need to keep records of the implementation process, detection do not expect the incident and the preservation of the scene when the abnormal operation of a screenshot . The results of data storage management through the logs in the log database to facilitate analysis of test personnel to view and test results.3.2 GUIATF the structure GUIATF a framework of four modules: object positioning, character transformation, messaging and logging, as shown in Figure 2. Object module will be targeted users to control the operation of objects into the framework of their own definition of GUIATF automation object, and then its position in the positioning process, the need to acquire control of a number of attributes, most often used is displayed in control Interface name. In a different language versions of the same controls are different from the name, character conversion module from the current environment of the type of language will want to crawl into the name of the current control environment in the corresponding language of the name, sent to the target location module. After the success of positioning objects, messaging module will simulate the operation of the user send the message to lock the target, such as: use your mouse to click on the button is positioned in the positioning or the edit box entry information. In the implementation of the above three modules in the process of tracking module logs of their work were recorded for further information in order to run automated test after test by checking the log information analysis test results.Figure 2 GUIATF the structure(1) Object orientation module GUIATF target positioning module so that the framework in dealing with control objects in a feature-rich interface , the test by calling them can be easily and efficiently automate the creation of objects , objects include automated retrieval of the object , activated objects, targeting the role of Status and location , and other functions. Application procedures for each of the main window controls are all in sub-window , including buttons , edit box , and so on , and they are in the Windows system window. Each window has a window handle in the system as the only logo , object orientation acquisition module through the window handle its own definition into the automation objects , mainly defined as shown in table 1.Table 1 target positioning module function and key members of attributesMembers of function and attributeFunctionPublic Constructor(stringName)According to create an automated name space objectinternal bool CheckForUnexpected Window()Detection do not expect the pop-up windowPublic AllSearch FindAllChildren( string FindName)Search all of the objectsPublicWinObj FindChild(Roles FindRole)Search the formulation of a targetPublic bool VerifyChildDoesNotExist(Roles FindRole)There is no verification of targetPublic int ChildCountget;Since the number of objects (attribute)Public intWindowHandleget;Object window handle (attribute)Public string Stateget;Object state (attribute)Public Roles Roleget;Object role (attribute)Public Rectangle Positionget;set;Object location (attribute)(2)Character conversion module Character conversion module achieved a framework for cross-language GUIATF automated testing capabilities . It will automate the object attribute information into the current dynamic environment corresponding language form of expression . In applications that exist in every string has a value of ID , uniquely identify the meaning of the string, we call it keys (KEY), for a button, can be more than the corresponding value (VALUE) , each A value on behalf of a language form of expression . Applications include all the components of a string of key collection , a number of key collection of the corresponding value of the collection , each set a value equivalent to a language pack . For example : We will be an English version of the application process is finished in Chinese language pack in the Chinese will replace English.Figure 3 characters in the course of conversion.GUIATF use the framework provided by the control interface to find targets, to achieve inter-language will not be able to control the use of targets in a specific language under the name, but by this name ID number,which is key(KEY),according to Get the current language environment the type of dynamic conversion of the characters corresponding expressions . The conversion process as shown in Figure 3 : To get the ID string conversion value, the first database to confirm the configuration parameters , including the storage of the database server name , database name , type and format of the current language , and then create a database connection , To find the language of the type and string as a parameter passed to the query order, execute a query can get the results we need conversion.(3)Messaging module Automation object positioning, messaging module to provide the appropriate interface will send a message to the system , the system response to notify the application automation object to trigger the implementation of the corresponding events. In this module, the main type of packaging the news mouse, keyboard and type of information sent news of control logic.Mouse type of information the user to use it in accordance with the definition of acts, including the left-click, double-click the left, right-click and drag.Define moduleMouseMessagepublic boolDragAndDrop (WinObj From, WinObj To) ;publicWinObj GetPopupMenu ( ) ;public void LeftClick ( ) ;public void LeftDoubleClick ( ) ;public voidMove ( Point Pos) ;public void RightClick ( ) ;.Keyboard definition of the types of information the press the button, Dan Qilai, multi-button choice, string and the entry button on the control automation object.Define module KeyBoardMessagepublic void KeyDown (Keys Key) ;public void KeyUp (Keys Key) ;public void Type (Keys KeyArray) ;public void Type ( string Text) ;public bool Type (WinObjWObject, Keys Key) ;public bool Type (WinObjWObject, Keys KeyArray) ;Graphical user interface of the operating efficiency performance of the machine , when the need to click on a dialog of a button , to open a dialog system to wait for the response to the news, in different machines or the environment , the response time is not the same And if the dialog does not appear to trigger the click of a button on the news operation will lead to the failure , therefore , need to send information to a certain logic to coordinate control ,including : According to the state of the user interface changes in the process of judgement when users failure to ensure that relevant information After the trigger corresponding response to the operation of the implementation. Definitions are as follows:Define module ControlLogicpublic boolWaitProcessIdle (WinObjWObject) ;public bool StateChange (WinObjWObject, States State, ) ;publicWinObjWaitDialogBox( string NameStartsWith) ;publicWinObjWaitWindow ( string NameStartsWith) ;publicWinObjWaitMessageBox( string NameStartsWith) ;(4) Logging Module Automated test case in bulk in the course of operation , the log records must include a test case not only the implementation details , but also to provide the implementation of the environmental test case , time , number and status information , which are responsible for the test case manager . GUIATF

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论