Saturday, November 27, 2010

Testing Eclipse RCP and Plug-in Applications

This blog post tackles the question "What is a must-have reading for a plug-in or RCP-apps developer when it comes to testing?"

Over the past couple of month, I collected more than 100 resources on testing Eclipse plug-ins and RCP applications. Today I want to share the 6 primary testing pointers, and summarize some of the most often stated recommendations on testing. This is a subjective collection, please feel free to add missing pointers in the comment section. On purpose, I spared links to specific utility tools or testing frameworks.

The main article and also starting point for further reading is the wiki entry on Automated Testing [1]. This article covers some basic information on how to run tests, suggests useful test utility frameworks and also presents a list of user interface (UI) test tools.
Another somewhat older article focuses on automating Eclipse PDE unit tests using Ant, and gives further pointers to articles about how to automate PDE tests [2].

From several documents on the web, as well as talks in Eclipse events like Eclipse Summit and EclipseCon, it is apparent that writing unit tests and having continuous integration/testing are recommended as a best practice for Eclipse development. As for example, the Architecture Council lists unit testing, and continuous integration under the top 10 project development practices [3].


Further Test Driven Development is one of the most discussed and recommended strategies when it comes to testing. There are several resources out there, I selected a TDD webinar by Kevin Taylor [4]. In his webinar he suggests to use the Model-View-Presenter pattern to separate concerns and thus the UI code from the logic behind, which in turn helps to reduce the code within the UI.

In addition I would like to include some pointers to books: First, the Eclipse specific book of Erich Gamma and Kent Beck “Contributing to Eclipse” [5], which explains how to contribute to Eclipse in a test driven way. Further, one very well known but general book on testing, by Binder, namely “Testing object-oriented systems: models, patterns, and tools”, provides several patterns that are handy for practical use [6].

What else has to be included in every Eclipse plug-in/RCP developer's reading list?
Missing something? Please leave a comment.

------------------------------------------ Edit:
I am happy that people responded to the post and extended my list of testing pointers.
Here the additional links from the comments:

"Agile Java(TM): Crafting Code with Test-Driven Development" by Jeff Langr.
"Effective Java" by Joshua Bloch.
"FAQ: How to build a product": http://wiki.eclipse.org/FAQ_How_do_I_create_an_Eclipse_product%3F
"Eclipse PDE Build - Tutorial": http://www.vogella.de/articles/EclipsePDEBuild/article.html
------------------------------------------

References:
[1]: http://wiki.eclipse.org/Automated_Testing
[2]: http://www.eclipse.org/articles/article.php?file=Article-PDEJUnitAntAutomation/index.html
[3]: http://wiki.eclipse.org/Architecture_Council/Top_Ten_Project_Development_Practices
[4]: http://live.eclipse.org/node/700
[5]: http://portal.acm.org/citation.cfm?id=961854
[6]: http://portal.acm.org/citation.cfm?id=338330

-------------------------------------------------------------

4 comments:

  1. Hi Michaela,

    I would add "Agile Java(TM): Crafting Code with Test-Driven Development" by Jeff Langr. And of course "Effective Java" by Joshua Bloch.

    ReplyDelete
  2. I would add the links for "how to build a product" from shell/Ant:
    http://wiki.eclipse.org/FAQ_How_do_I_create_an_Eclipse_product%3F
    http://www.vogella.de/articles/EclipsePDEBuild/article.html
    and how to add files to the root of yout product (interesting for testing):
    http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.pde.doc.user/tasks/pde_rootfiles.htm

    I did a testing environment for my app with the above links for my RCP app (includes EMF, GEF, RCP) and an SWTBot environment for the same with just building products with PDE with the approbriate product definitions and some small ANT scripts. If you are interessted, please call me the place to upload the samples.

    ReplyDelete
  3. Good list - I think it's important to cover UI testing too. Seperating the layers of your application allows unit testing of everything outside the UI layer. I've found that Google WindowTester is probably the best alternative to SWTBot.
    James

    ReplyDelete
  4. Thanks for the additional links and testing pointers. I added them to the original blog post.

    Yes, UI testing and UI testing tools are definitely topics worth talking about. In this post, though, I wanted to keep it more general and also vendor independent. But, you are right, UI deserves a post on its own.

    ReplyDelete