2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩12頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、<p><b>  附錄1外文譯文</b></p><p>  GUI自動化測試研究</p><p>  摘要:指出了目前自動化測試所采用的錄制技術存在的不足,針對不斷變化的圖形用戶界面測試代碼很難維護和擴展的問題,采用基于對象的捕捉技術,設計了以Windows消息機制為基礎的GU IATF測試框架,實現(xiàn)了高度靈活并易于擴展的圖形用戶界面自動化測試。<

2、/p><p>  關鍵詞:軟件測試;回歸測試;自動化</p><p><b>  0.引言</b></p><p>  測試是一種旨在評估一個程序或系統(tǒng)的屬性或能力,確定它是否符合其所需結果的活動。在整個軟件開發(fā)過程中,從需求分析到系統(tǒng)設計直到代碼實現(xiàn),都會出現(xiàn)或多或少的問題。如何保障軟件的質量,軟件測試就成為關鍵的技術。軟件測試的工作量很大并具有

3、一定的重復性,尤其在測試后期所進行的回歸測試中(回歸測試在軟件出現(xiàn)發(fā)展性的改變和修正性改變時運行),需要驗證以前發(fā)現(xiàn)的問題在新版本中是否解決,大部分測試工作是重復的。實現(xiàn)軟件測試的自動化可以使大量的測試程序化地反復執(zhí)行,不僅節(jié)約了大量的勞動力,而且提高了測試效率并保證了測試的質量。</p><p><b>  1.錄制技術的不足</b></p><p>  目前一些錄

4、制技術被應用到圖形用戶界面的自動化測試中,在軟件開發(fā)周期中,系統(tǒng)需要不斷地更新和維護,為了保證測試質量,測試代碼對不斷變化的系統(tǒng)要有很強的適應能力,換句話說,測試也同樣需要維護。測試腳本的錄制過程是根據具體的界面和操作進行的,一旦腳本的執(zhí)行界面發(fā)生改變,運行就會出現(xiàn)異常,甚至僅僅是被操作對象位置的改變或圖像分辨率的改變都可能會造成圖形用戶界面自動化測試的失敗,因此,基于錄制技術的自動化測試維護的代價相當高。另外,腳本錄制的過程是固定的,

5、所以腳本的運行會完全按照操作步驟,不具備靈活性。</p><p>  2.自動化測試框架的提出</p><p>  在目前的軟件測試中,一個備受關注的問題是如何高效地實現(xiàn)圖形用戶界面的自動化測試,并使測試代碼具有很高的靈活性。本文提出了一種基于對象捕捉技術的圖形用戶界面自動化測試框架GUIATF(Graphics User Interface Automation Testing Fram

6、ework),為測試人員方便地創(chuàng)建并靈活地維護測試代碼提供保證。當用戶界面發(fā)生變化時,測試代碼能很快地進行更新,對用戶界面的變化有很強的適應能力。</p><p>  3.GUIATF框架的工作原理</p><p>  GUIATF框架的基礎是消息機制,通過消息的發(fā)送來觸發(fā)相應的事件。消息的初始接收器必須是窗口對象。Windows消息通常直接由該窗口對象處理。通常產生于應用程序主框架窗口的

7、命令消息被傳送到命令傳送中描述的命令目標鏈。GUIATF框架要完成的任務是為測試人員開發(fā)自動化測試代碼提供功能強大的接口,模擬測試用例中定義的用戶操作,通知系統(tǒng)發(fā)送一系列的消息給應用程序,實現(xiàn)測試用例的自動化運行。</p><p>  3.1 GUIATF的作用</p><p>  圖1 GUIATF的作用</p><p>  從圖1可以看出GUIATF將消息發(fā)送給

8、系統(tǒng),系統(tǒng)響應消息之后通知應用程序來觸發(fā)對應的事件,完成測試用例中定義的一系列用戶操作。GUIATF是連接應用程序和用戶操作的橋梁。在自動化測試過程中,測試用例是批量運行的,為了跟蹤測試結果,GUIATF需要不斷記錄執(zhí)行過程、探測不期望出現(xiàn)的事件以及在運行異常時保存現(xiàn)場截圖。這些結果數據通過日志管理存儲在日志數據庫中,便于測試人員查看和分析測試結果。</p><p>  3.2 GUIATF的結構</p&g

9、t;<p>  GUIATF框架由四個模塊構成:對象定位、字符轉換、消息發(fā)送和日志記錄,如圖2所示。對象定位模塊將用戶要操作的控件對象轉化為GUIATF框架自身定義的自動化對象,然后再對其定位,在定位過程中,需要獲取控件的一些屬性信息,最常用到的是控件顯示在界面上的名稱。在不同的語言版本中,同一個控件的名稱是不同的,字符轉換模塊提取當前環(huán)境的語言類型,將要檢索的控件名稱轉換為當前語言環(huán)境中對應的名稱,發(fā)送給對象定位模塊。對

10、象定位成功后,消息發(fā)送模塊將模擬用戶操作的消息發(fā)送到被鎖定的對象,比如:用鼠標點擊被定位的按鈕或在被定位的編輯框中錄入信息等。在以上三個模塊執(zhí)行的過程中,日志跟蹤模塊分別記錄它們工作的詳細信息,以便自動化測試運行結束后,測試人員通過查看日志信息分析測試結果。</p><p>  圖2 GUIATF的結構</p><p><b>  (1)對象定位模塊</b></

11、p><p>  對象定位模塊使GUIATF框架在處理控件對象方面具備功能豐富的接口,測試人員通過調用它們可以方便、高效地實現(xiàn)自動化對象的創(chuàng)建、檢索自動化對象包含的子對象、激活對象、確定對象角色、狀態(tài)和位置等功能。應用程序中的每一個控件都屬于主窗口中的子窗口,包括按鈕、編輯框等,它們都是Windows系統(tǒng)中的窗口。每個窗口都有一個窗口句柄作為其在系統(tǒng)中的唯一標識,對象定位模塊通過獲取窗口句柄將其轉化為自身定義的自動化對

12、象,主要定義如表1所示。</p><p>  表1 對象定位模塊主要成員函數及屬性</p><p><b>  (2)字符轉換模塊</b></p><p>  字符轉換模塊實現(xiàn)了GUIATF框架跨語言自動化測試的能力。它將自動化對象的屬性信息動態(tài)轉換為當前語言環(huán)境下對應的表現(xiàn)形式。在應用程序中存在的每一個字符串都有一個ID值,唯一地標識該字符串

13、的含義,我們把它稱為鍵(KEY),對于一個鍵,可以對應多個值(VALUE),每一個值代表一種語言的表現(xiàn)形式。應用程序中包含的所有字符串組成一個鍵的集合,這個鍵集合對應了多個值集合,每一個值集合相當于一個語言包。比如:我們將一個英文版的應用程序漢化的過程就是用中文語言包中的漢語將英文替換。</p><p><b>  圖3 字符轉換過程</b></p><p>  使用

14、GUIATF 框架提供的接口查找控件對象時,要實現(xiàn)跨語言就不能使用控件對象在一種具體語言下的名稱,而要通過此名稱的ID 號,也就是鍵(KEY),根據所獲取當前語言環(huán)境的類型,動態(tài)轉換對應的字符表現(xiàn)形式。轉換過程如圖3所示:在得到要轉換字符串的ID值之后,首先確認數據庫的配置參數,包括存放數據庫的服務器名稱,數據庫名稱,當前語言類型和格式等,然后創(chuàng)建與數據庫的連接,把要查找的語言類型和字符串作為參數傳遞給查詢命令,執(zhí)行查詢就可以獲取我們需

15、要的轉換結果。</p><p><b>  (3)消息發(fā)送模塊</b></p><p>  自動化對象定位之后,消息發(fā)送模塊提供相應的接口將消息發(fā)送給系統(tǒng),系統(tǒng)響應后通知應用程序觸發(fā)自動化對象執(zhí)行對應的事件。在這個模塊中,主要封裝了鼠標消息類型、鍵盤消息類型以及消息發(fā)送的控制邏輯。</p><p>  鼠標消息類型根據用戶使用它的行為定義,包括

16、左鍵單擊、左鍵雙擊、右鍵單擊和拖動。</p><p>  Define moduleMouseMessage</p><p><b>  {</b></p><p>  public boolDragAndDrop (WinObj From, WinObj To) ;</p><p>  publicWinObj Get

17、PopupMenu ( ) ;</p><p>  public void LeftClick ( ) ;</p><p>  public void LeftDoubleClick ( ) ;</p><p>  public voidMove ( Point Pos) ;</p><p>  public void RightClick

18、( ) ;</p><p><b>  ?</b></p><p><b>  }</b></p><p>  鍵盤消息類型定義了單鍵的按下、彈起,多鍵的選擇,字符串的錄入以及功能鍵對自動化對象的控制。</p><p>  Define module KeyBoardMessage</p>

19、;<p><b>  {</b></p><p>  public void KeyDown (Keys Key) ;</p><p>  public void KeyUp (Keys Key) ;</p><p>  public void Type (Keys[ ]KeyArray) ;</p><p&g

20、t;  public void Type ( string Text) ;</p><p>  public bool Type (WinObjWObject, Keys Key) ;</p><p>  public bool Type (WinObjWObject, Keys[ ]KeyArray) ;</p><p><b>  ?</b>

21、;</p><p><b>  }</b></p><p>  圖形用戶界面的操作效率受機器性能的影響,當需要點擊某個對話框的一個按鈕時,向系統(tǒng)發(fā)出打開對話框的消息要等待響應,在不同的機器或環(huán)境中,響應的時間是不一樣的,如果對話框沒有出現(xiàn)就觸發(fā)點擊按鈕的消息會導致操作的失敗,因此,消息的發(fā)送需要一定的控制邏輯來協(xié)調,包括:根據用戶界面狀態(tài)的變化判斷用戶進程何時失效,確

22、保相關消息響應之后觸發(fā)對應操作的執(zhí)行。主要定義如下所示:</p><p>  Define module ControlLogic</p><p><b>  {</b></p><p>  public boolWaitProcessIdle (WinObjWObject) ;</p><p>  public boo

23、l StateChange (WinObjWObject, States State, ) ;</p><p>  publicWinObjWaitDialogBox( string NameStartsWith) ;</p><p>  publicWinObjWaitWindow ( string NameStartsWith) ;</p><p>  publ

24、icWinObjWaitMessageBox( string NameStartsWith) ;</p><p><b>  ?</b></p><p><b>  }</b></p><p><b>  (4)日志記錄模塊</b></p><p>  在測試用例的批量自動化運

25、行過程中,日志記錄不僅需要包含測試用例的執(zhí)行細節(jié),而且還要提供測試用例執(zhí)行的環(huán)境、時間、次數和狀態(tài)等信息,這些信息都是測試用例管理器負責的。GUIATF框架的日志記錄模塊通過調用測試用例管理器提供的接口實現(xiàn)日志的存儲和查詢。</p><p>  4.GUIATF框架的優(yōu)勢</p><p>  (1)方便測試用例的創(chuàng)建和修改:GUIATF框架的設計思想是基于對象捕捉的,只要被操作對象存在于用

26、戶界面中,即使位置或圖像分辨率發(fā)生變化,測試代碼會根據對象的特征進行準確地定位并對其操作。</p><p>  (2)詳細的運行日志:提供詳細、準確的運行日志并檢測不期望彈出的對話框,保存錯誤現(xiàn)場的截圖,使測試人員快速地定位存在的錯誤。</p><p>  (3)語言中立:提供測試代碼的多語言支持,一份測試代碼可以成功地運行在多語言環(huán)境中,完美地實現(xiàn)了自動化測試的跨語言能力。</p&

27、gt;<p><b>  5.結束語</b></p><p>  GUIATF框架提供了功能豐富的接口,大大提高了用戶界面自動化測試代碼的開發(fā)效率。測試人員通過調用GUIATF框架提供的功能可以高效、靈活地實現(xiàn)測試邏輯,不會像錄制技術那樣因為測試腳本的固定使得測試很難維護。在模擬多用戶的并發(fā)操作中,GUIATF框架在實現(xiàn)多機并發(fā)操作中還存在一定的不足,目前雖然實現(xiàn)了多機進程間的

28、通訊和同步,但是和測試用例管理器還沒有建立連接,沒有實現(xiàn)并發(fā)測試批量運行日志的統(tǒng)一管理。另外,多機運行并發(fā)測試在調試方面也比較復雜,對調試技巧有很高的要求,在下階段的工作中將對其進行重點研究。</p><p><b>  附錄2外文原文</b></p><p>  Research on GUI Automation Testing[25]</p>&l

29、t;p>  Abstract: 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

30、 IATF framework based on Windows message mechanism and imp lements GUI automation testing , largely imp roved agility of automation testing.</p><p>  Key words: software testing; regression testing; auto

31、mation</p><p>  0.Introduction</p><p>  Is 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 en

32、tire 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

33、 key technology. Software testing the heavy workload and has a repetitive, especially in the latter part of tests conducted by</p><p>  1.The lack of recording technology</p><p>  At present, so

34、me 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

35、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 interf

36、ace and, once the script of the implementation</p><p>  2.Automated test framework of the proposed</p><p>  In the current software testing, one area of concern is how to achieve efficient gra

37、phical 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 Interf

38、ace 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 up</p><p>  3.G

39、UIATF framework of the working principle</p><p>  GUIATF framework is based on the information mechanism, the message sent through the appropriate incident to trigger . The initial news receiver must be the

40、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 describe

41、d in the order linked objectives . GUIATF framework to complete the task is to test the development of automated test cod</p><p>  3.1The role of GUIATF</p><p>  Figure 1 GUIATF role</p>

42、<p>  Can 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 d

43、efinition 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 nee

44、d to keep records of the implementation process, detection do not exp</p><p>  3.2 GUIATF the structure </p><p>  GUIATF a framework of four modules: object positioning, character transforma

45、tion, 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

46、 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</p><

47、p>  Figure 2 GUIATF the structure</p><p>  (1) Object orientation module </p><p>  GUIATF target positioning module so that the framework in dealing with control objects in a feature-rich

48、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 , a

49、nd 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 Windo</p><p>  Table 1 target positionin

50、g module function and key members of attributes</p><p>  (2)Character conversion module </p><p>  Character conversion module achieved a framework for cross-language GUIATF automated test

51、ing 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

52、, 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 expr</p><p>  Figure 3 char

53、acters in the course of conversion.</p><p>  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

54、 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

55、process as shown in Figure 3 : To get the ID string conversion value, the first database to confirm the configuratio</p><p>  (3)Messaging module </p><p>  Automation object positioning, messa

56、ging 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 m

57、odule, the main type of packaging the news mouse, keyboard and type of information sent news of control logic.</p><p>  Mouse type of information the user to use it in accordance with the definition of acts,

58、 including the left-click, double-click the left, right-click and drag.</p><p>  Define moduleMouseMessage</p><p><b>  {</b></p><p>  public boolDragAndDrop (WinObj From

59、, WinObj To) ;</p><p>  publicWinObj GetPopupMenu ( ) ;</p><p>  public void LeftClick ( ) ;</p><p>  public void LeftDoubleClick ( ) ;</p><p>  public voidMove ( Point

60、 Pos) ;</p><p>  public void RightClick ( ) ;</p><p><b>  ...</b></p><p><b>  }</b></p><p>  Keyboard definition of the types of information t

61、he press the button, Dan Qilai, multi-button choice, string and the entry button on the control automation object.</p><p>  Define module KeyBoardMessage</p><p><b>  {</b></p>

62、<p>  public void KeyDown (Keys Key) ;</p><p>  public void KeyUp (Keys Key) ;</p><p>  public void Type (Keys[ ]KeyArray) ;</p><p>  public void Type ( string Text) ;</p&g

63、t;<p>  public bool Type (WinObjWObject, Keys Key) ;</p><p>  public bool Type (WinObjWObject, Keys[ ]KeyArray) ;</p><p><b>  …</b></p><p><b>  }</b>&

64、lt;/p><p>  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

65、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

66、information to a certain logic to coordinate control ,including : According to</p><p>  Define module ControlLogic</p><p><b>  {</b></p><p>  public boolWaitProcessI

67、dle (WinObjWObject) ;</p><p>  public bool StateChange (WinObjWObject, States State, ) ;</p><p>  publicWinObjWaitDialogBox( string NameStartsWith) ;</p><p>  publicWinObjWaitWindow

68、 ( string NameStartsWith) ;</p><p>  publicWinObjWaitMessageBox( string NameStartsWith) ;</p><p><b>  …</b></p><p><b>  }</b></p><p>  (4) Loggi

69、ng Module </p><p>  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 envi

70、ronmental test case , time , number and status information , which are responsible for the test case manager . GUIATF framework of the log records by calling the test case management module provides the interface of the

71、 store and query logs.</p><p>  4. GUIATF framework of the advantages </p><p>  (1) test case for the creation and modification : GUIATF framework for the design idea is based on the capture

72、 of the object , as long as the object exists in the operation of the user interface , location or even change image resolution , testing code based on the characteristics of accurate target To locate and its operation

73、. </p><p>  (2) a detailed log of the operation : to provide detailed and accurate detection of running logs and do not expect the pop-up dialog, wrong-site preservation of the shots, to test quickly t

74、he wrong location. </p><p>  (3) neutral language: the test code multi-language support, a test code can be run successfully in an environment of the perfect realization of the automated testing of the i

75、nter-language ability.</p><p>  5.Concluding remarks </p><p>  GUIATF framework provides a feature-rich interface , greatly improving the user interface of the automated test code development e

76、fficiency . Test by calling GUIATF framework of the functions can provide efficient and flexible manner to achieve test logic , not as recording technology because the test scripts that make the test difficult to

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論