没有合适的资源?快使用搜索试试~ 我知道了~
首页使用SWTBOT进行GUI自动化测试
资源详情
资源评论
资源推荐

Milosz Mazurkiewicz
GUI TEST AUTOMATION WITH SWTBOT
Technology and Communication
2010


VAASAN AMMATTIKORKEAKOULU
UNIVERSITY OF APPLIED SCIENCES
Degree Programme of Information Technology
ABSTRACT
Author Milosz Mazurkiewicz
Title GUI Test Automation with SWTBot.
Year 2010
Language English
Pages 50 + 3 Appendices
Name of Supervisor Dr Smail Menani (VAMK), Jakub Drzazga (NSN)
In this thesis the author presents theoretical background of GUI test automation as well
as technologies, tools and methodologies required to fully understand the test program
written in SWTBot. Practical part of the thesis was to implement a program testing File
Menu options of Pegasus RCP application developed in Nokia Siemens Networks.
Concluding this dissertation, in the author’s opinion test programs written using
SWTBot are relatively easy to read and intuitive for people familiar with basic concepts
of Eclipse RCP. Without any doubt SWTBot’s API is large enough to test effectively
such complex application as Pegasus RCP. The biggest problem could be lack of good
documentation and tutorials which makes it difficult to start with. The best and most up
to date is Javadoc that comes with SWTBot’s code. Therefore a developer which wants
to start writing SWTBot tests has to spend some time with it to get familiar with the API
experimenting with the code. Although SWTBot is not a commercial tool, the growing
community of testers and developers using it seems promising considering the need of
support. Despite of what is published on SWTBot’s home page, SWTBot lacks
a recorder which implicates that the tester has to be a programmer. As the analysis has
shown the automated tests execute over twenty times faster comparing with manual
tests.
Pieces of code presented in this document, instructions how to achieve tests
independence, error recovery, and test synchronization, together with big test program
implementation (APPENDIX 2) make up a great tutorial which will help developers
to get familiar with SWTBot’s capabilities. FileMenuTest.java consists of 30 test cases
and has almost 1500 lines of code. The author has made those tests compliant with all
the objectives for well-designed test cases. The program was integrated with the nightly
builds of CruiseControl, which means the author’s work is utilised on a daily basis.
Keywords SWTBot, software testing, GUI testing, test automation

2 (50)
CONTENTS
1 INTRODUCTION ..............................................................................................7
1.1 Rationale and Background of the Project .................................................7
1.2 Aims and Restrictions...............................................................................7
1.3 Materials for Thesis Writing.....................................................................7
2 THEORY OF GUI TEST AUTOMATION .......................................................9
2.1 Introduction and Background ...................................................................9
2.2 Why Do We Need a Methodology for GUI Testing?...............................9
2.3 The Benefits of Test Automation............................................................10
2.4 The Risks of Test Automation................................................................12
2.5 Test Planning and Design .......................................................................14
2.5.1 The Purpose of Test Documentation ...........................................15
2.5.2 Finding Bugs During Test Design Process..................................16
2.6 Well-designed Test Cases.......................................................................17
2.6.1 A Test Case Is Independent.........................................................18
2.6.2 A Test Case Has a Single Purpose...............................................18
2.6.3 Unsuccessful Test Case Should Not Cause Others to Fail..........19
2.6.4 A Test Case Is Well Documented................................................19
2.7 Standardised error recovery....................................................................19
2.8 Testing in Agile Development Environment..........................................20
2.8.1 Agile Methodology......................................................................20
2.8.2 Agile Testing ...............................................................................21
2.9 Best Practices Summarised.....................................................................22
2.9.1 Test Project Planning...................................................................22
2.9.2 Writing the Tests .........................................................................23
3 SWTBOT IN GUI TEST AUTOMATION......................................................25
3.1 Introduction to SWTBot .........................................................................25
3.2 Installation and Configuration of SWTBot.............................................26
3.2.1 Install Eclipse IDE.......................................................................26
3.2.2 Install SWTBot Plug-in ...............................................................26
3.2.3 Create Test Plug-in......................................................................27
3.2.4 Create a Simple Test....................................................................28

3 (50)
3.2.5 Run a Test ................................................................................... 28
3.3 Eclipse RCP............................................................................................ 29
4 DESCRIBING SWTBOT TEST CODE.......................................................... 31
4.1 The Skeleton of the Code ....................................................................... 31
4.2 SWTBot API in Examples ..................................................................... 32
4.2.1 Menu ........................................................................................... 33
4.2.2 Views .......................................................................................... 33
4.2.3 Editors ......................................................................................... 33
4.2.4 Windows ..................................................................................... 34
4.2.5 Tree ............................................................................................. 34
4.2.6 Perspectives................................................................................. 35
4.2.7 Buttons ........................................................................................ 35
4.2.8 Tool Bar Buttons......................................................................... 35
4.2.9 Check Boxes ............................................................................... 35
4.2.10 Text Fields................................................................................... 35
4.2.11 Time and Speed Control.............................................................. 36
4.3 Error Recovery Implementation............................................................. 36
4.3.1 Test without Error Recovery....................................................... 36
4.3.2 Test with Error Recovery............................................................ 37
4.4 Tests Independence Implementation...................................................... 38
4.4.1 Cleanup Method.......................................................................... 39
4.4.2 Test Synchronisation................................................................... 39
5 ANALYSIS ...................................................................................................... 41
5.1 Analysis of Capture/Playback Mechanism............................................. 41
5.1.1 Why Capture/Playback Is a False Economy? ............................. 41
5.1.2 Recorder in SWTBot – a Marketing Stunt.................................. 42
5.2 What Cannot Be Tested with SWTBot .................................................. 42
5.3 Measuring Benefit of Using Automated Tests....................................... 43
6 CONCLUSION ................................................................................................ 47
LITERATURE FOR THESIS WRITING ............................................................ 49
APPENDICES
剩余51页未读,继续阅读





安全验证
文档复制为VIP权益,开通VIP直接复制

评论1