Book Image

Eclipse Plug-in Development Beginner's Guide - Second Edition

By : Alex Blewitt
Book Image

Eclipse Plug-in Development Beginner's Guide - Second Edition

By: Alex Blewitt

Overview of this book

Eclipse is used by everyone from indie devs to NASA engineers. Its popularity is underpinned by its impressive plug-in ecosystem, which allows it to be extended to meet the needs of whoever is using it. This book shows you how to take full advantage of the Eclipse IDE by building your own useful plug-ins from start to finish. Taking you through the complete process of plug-in development, from packaging to automated testing and deployment, this book is a direct route to quicker, cleaner Java development. It may be for beginners, but we're confident that you'll develop new skills quickly. Pretty soon you'll feel like an expert, in complete control of your IDE. Don't let Eclipse define you - extend it with the plug-ins you need today for smarter, happier, and more effective development.
Table of Contents (24 chapters)
Eclipse Plug-in Development Beginner's Guide Second Edition
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 11 – Automated Testing of Plug-ins


Understanding swtbot

1. The unit runner that is required is SWTBotJunit4ClassRunner, which is set up with an annotation @RunWith(SWTBotJunit4ClassRunner.class).

2. Views are set up by driving the menu to perform the equivalent of Window | Show View | Other… and driving the value of the dialog.

3. To get the text value of a dialog, use textWithLabel to find the text field next to the associated label, and then get or set the text from that.

4. A Matcher is used to encode a specific condition, such as a view or window with a particular title. It can be handed over to the SWTBot runner to execute in the UI thread and return a value when it is done.

5. To get values from the UI, use a StringResult (or other equivalent types) and pass that into the syncExec method of UIThreadRunnable. It will execute the code, return the value, and then pass that to the calling thread.

6. Use the bot's waitUntil or waitWhile methods, which block execution of the test until a certain condition occurs.