王凡臺灣大學:電機工程學研究所董明昌Tung, Ming-ChangMing-ChangTung2007-11-262018-07-062007-11-262018-07-062007http://ntur.lib.ntu.edu.tw//handle/246246/52975本論文中,研究如何能夠使測試者更容易地建立以及實作測試案例來進行軟體測試。根據各種不同的待測物以及所在的平台,每一待測物都擁有自己使用的溝通方式,而且每一個平台也有自己所提供的應用程式介面。因此我們利用測試和測試控制表示法第三版(TTCN-3)來進行待測物轉接器(SUT Adaptor)以及平台轉接器(Platform Adaptor)的建置。 在實驗中,我們發展了一個行動電話模擬器來當作本論文實驗的待測物,並根據此待測物以及我們所在之平台建置了待測物轉接器及平台轉接器。同時,開發了一個圖形化介面的即時測試剖繪工具,能夠更使測試過程中的觀察更加的便利。 在論文之中,我們使用了圖形化介面的測試案例編輯器以及測試案例的編譯器來建置並編譯測試案例。並討論我們在實作待測物、標準轉接器、以及圖形化測試剖繪工具的技術。We investigate the issue of the software testing to have an easier way constructing and implementing the testcases. For a variety of the SUT (System Under Test) and the platform, each SUT has its own kind of communication and each platform has its own API (Application Program Interface), so we use the international standard of TTCN-3 (Testing and Test-Notation, version 3) to implement the SUT adaptor and the platform adaptor. In the experiment, we have developed a mobile phone system simulator as the SUT for our experiment. We also implement the SUT adaptor and the platform adaptor for our SUT, We also develop a GUI real time testing probing tool to make the observation easy while testing. We use a testcase graphical editor and a testcase compiler that translates the testcases to executables in C/C++ with our adaptors. In this thesis, we report the implementation technology of the SUT, the standard adaptors, and the graphical profiling tool.Contents i List of Figures iv Acknowledgements vii 1 Introduction 1 1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.4 Thesis Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 TTCN-3 4 2.1 TTCN-3 Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.1 Definition Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.2 Control Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.3 Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.4 Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.5 Message-based Communication . . . . . . . . . . . . . . . . . . . . . 9 2.1.5.1 Send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.5.2 Receive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.6 Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2 Graphical Presentation Format of TTCN-3 . . . . . . . . . . . . . . . . . . . 10 2.2.1 GFT and TTCN-3 core language . . . . . . . . . . . . . . . . . . . . 10 2.2.2 A GFT example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3 TTCN-3 Runtime Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3 Adaptors 15 3.1 TTCN-3 Runtime Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.1.1 The triCommunication Interface . . . . . . . . . . . . . . . . . . . . . 16 3.1.2 The triPlatform Interface . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2 SUT Adaptor (SA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3 Platform Adaptor (PA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4 Implementation 19 4.1 TTCN-3 to XML Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.1.1 XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.1.2 Lex & Yacc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.1.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.1.4 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.2 Profiling Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.2.1 wxWidgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.2.2 Tool Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.2.3 Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.3 SUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.3.1 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.3.2 Test System Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.3.3 Automaton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.4 Adaptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.4.1 SA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.4.2 PA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5 Experiment 39 6 Related Works 44 7 Conclusions and Future Works 46 A The TSI Definitions of Cell618 48 A.1 TSI in TTCN-3 Core Language . . . . . . . . . . . . . . . . . . . . . . . . . 48 A.2 KEY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 A.3 State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 A.4 Means of Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 B The Definitions of the Classes in the Profiling Tool 51 C The Pseudo Codes of the SA and the PA 56 C.1 SA functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 C.2 PA functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Bibliography 60 List of Figures 1.1 The entire architecture of the integrated automatic testing tool . . . . . . . . 2 2.1 TTCN-3 presentation formats . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 Conceptual view of a typical TTCN-3 test configuration . . . . . . . . . . . 6 2.3 Relation between TTCN-3 core language and the corresponding GFT description 11 2.4 An example of GFT diagram corresponding to Table 2.6 . . . . . . . . . . . 12 3.1 The TTCN-3 runtime interface between the TTCN-3 executable and the adaptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1 The architecture of the TTCN-3 to XML parser . . . . . . . . . . . . . . . . 20 4.2 The flow chart of function trace . . . . . . . . . . . . . . . . . . . . . . . . 24 4.3 The flow chart of function constructNode . . . . . . . . . . . . . . . . . . . 25 4.4 The flow chart of function constructLeaf . . . . . . . . . . . . . . . . . . . 26 4.5 The snapshot of the profiling tool . . . . . . . . . . . . . . . . . . . . . . . . 29 4.6 The file menu of the profiling tool . . . . . . . . . . . . . . . . . . . . . . . . 29 4.7 The cutting apart snapshot of the profiling tool . . . . . . . . . . . . . . . . 30 4.8 The framework of the profiling tool . . . . . . . . . . . . . . . . . . . . . . . 30 4.9 The architecture of the profiling tool . . . . . . . . . . . . . . . . . . . . . . 32 4.10 The result snapshot of the SUT configuration, workload 10% . . . . . . . . . 33 4.11 The result snapshot of the SUT configuration, workload 80% . . . . . . . . . 34 4.12 The result snapshot of the SUT configuration, workload 90% . . . . . . . . . 34 4.13 The automaton of the Cell618 . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.1 The relation between the number of lines in a testcase and the time for parsing 41 5.2 The relation between the number of lines of a testcase in C++ codes and in the XML format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.3 The execution of the testcase for powering on the Cell618 . . . . . . . . . . . 42 5.4 The executing of the bug-reproduce testcase for powering on the Cell618 . . 43 List of Tables 2.1 TTCN-3 module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 The elements in TTCN-3 module definition part . . . . . . . . . . . . . . . . 7 2.3 A example for port definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4 A example for component definitions . . . . . . . . . . . . . . . . . . . . . . 9 2.5 The Timer operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.6 An example of TTCN-3 core language . . . . . . . . . . . . . . . . . . . . . 13 3.1 The triMap of the TRI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2 The triSend of the TRI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3 The triStartTimer of the TRI . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.4 The SA functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.5 The PA functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.1 An example of the translation from the grammar of the TTCN-3 core language to the XML format: (a). One example of the grammar; (b). The corresponding XML translated by our Parser. . . . . . . . . . . . . . . . . . 26 4.2 The attributes in the XML format . . . . . . . . . . . . . . . . . . . . . . . . 27 4.3 The definition of the class MyShape . . . . . . . . . . . . . . . . . . . . . . . 31 5.1 The testcases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 A.1 The input key messages of the Cell618 . . . . . . . . . . . . . . . . . . . . . 49 A.2 The state identity of Cell618 . . . . . . . . . . . . . . . . . . . . . . . . . . . 503855946 bytesapplication/pdfen-US自動測試測試案例測試和測試控制表示法第三版錯誤重建剖繪test automationtestcaseTTCN-3TRIbug-reproduceprofiling可設定之行動電話模擬器中待測軟體的剖繪與TTCN-3轉接器的建置SUT Profiling and TTCN-3 Adaptor Construction for A Configurable Mobile Phone Simulatorthesishttp://ntur.lib.ntu.edu.tw/bitstream/246246/52975/1/ntu-96-R94921099-1.pdf