Testing Eclipse plug-ins: Tips & Tricks

In this talk we want to share some tips and tricks on how to test Eclipse plug-ins at several stages during the development. In particular, we will show how to do without a running workbench (i.e., without “Plug-in tests”) and without functional testing frameworks (e.g., SWTBot) as much as possible, relying only on plain JUnit tests.
Indeed, many important parts of the components of an Eclipse plug-in can be tested with a plain JUnit test. Note that we are not talking only about core, non UI, parts: even those parts that need SWT or Jface (e.g., label and content providers, tree and table viewers) can be almost entirely tested without an Eclipse workbench (for most tests, you don’t even need a Display). With that respect, we will show some testing utility classes that can be reused in your projects. We will also show some examples of mocking to make tests cleaner and to be able to test even corner case situations. Using plain JUnit tests as much as possible has the huge advantage of making your software much easier and much faster to test (we’re talking about seconds instead of several minutes).
Then we will also show when to write “Plug-in tests”, in order to test the features that actually need a running workbench; in this case, we will follow a programmatic approach and we will then switch to a functional testing framework (e.g., SWTBot) only when we really need to test the actions that a user would perform on our Eclipse plug-ins. Even for functional testing, using, e.g., SWTBot, we will show some best practices for testing only your own plug-ins behavior.
Finally, we will also present some tips & tricks when testing with Maven/Tycho, especially if you want your tests be reproducible both in Eclipse and during the Maven build. We will also write (end-to-end) tests on a fully provisioned product (being that a custom Eclipse product or a standard Eclipse installation with our plug-ins installed). This will make sure that the features you deploy have all the needed dependencies so that your users will not have bad surprises.
The talk will use simple examples and all the techniques and source code will be easily reusable in other Eclipse projects.

Schedule info
Session Time Slot(s): 
Wednesday, October 25, 2017 - 10:30 to 11:05
Lorenzo Bettini (Dipartimento di Statistica, Informatica, Applicazioni, University Firenze)'s picture

This talk is partly based on the talk we gave at EclipseCon France https://www.eclipsecon.org/france2017/session/testing-eclipse-plug-ins-u... , that received nice feedbacks. In this very talk we will use more general examples and we will provide more details on tips & tricks (including more running demos).

Public comment

Our Sponsors

For information about becoming a sponsor, please visit the EclipseCon Europe 2017 sponsor prospectus page.

Elite Dual ECE/OSGi CE



Club ECE Sponsor

IoT Theme Day

Project Quality Day

Smart Home Day


EclipseCon Support Other Events

Our Other Events

Eclipse events are hosted all over the world!

  • EclipseCon Europe 2018