The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Developing Eclipse RCP apps? Want access to Display etc will running your Unit Tests

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Mark Levison

Posts: 877
Nickname: mlevison
Registered: Jan, 2003

Mark Levison an agile software developer who writes Notes from a tool user.
Developing Eclipse RCP apps? Want access to Display etc will running your Unit Tests Posted: Jun 21, 2007 1:53 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Mark Levison.
Original Post: Developing Eclipse RCP apps? Want access to Display etc will running your Unit Tests
Feed Title: Notes from a Tool User
Feed URL: http://feeds.feedburner.com/NotesFromAToolUser
Feed Description: Thoughts about photography, software development, reading, food, wine and the world around us.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Mark Levison
Latest Posts From Notes from a Tool User

Advertisement

For those of you spend your days working in Eclipse and trying to build rich client applications (RCP) the following piece of arcana will be useful. As your developing RCP applications you will undoubtedly need to test classes that require the Display, access to Graphics or other classes that require a running Application. When I first encountered this problem I thought that I was boxed in by Eclipse - but thanks for the work of David Saff you can. The secret sauce: JUnit Plugin tests.

  1. To run the tests choose ‘Run…’ either via the context menu in the package explorer or via the Run menu item.
  2. Choose JUnit Plug-in test (not plain old Junit) This provides the tests with access to their plug-in’s plugin class – very important if you want to access the filesystem or other resources under eclipse’s control (Display, ...)
  3. Use the new button either top left of the dialog or via the context menu. A new test will be created that should have the plugin/package/testcase that you selected as its target.
  4. Switch to the main tab and under ‘Program to run’ switch from org.eclipse.ui.workbench to [No Application] – Headless. This avoids have an IDE popup and disappear at the start of your tests. On my machine this shaves 3-4 seconds from the test startup time.
  5. Switch to the plug-ins tab and the 'Choose plug-ins and fragments' radio button
  6. Click 'Deselect All' the existing plugins.
  7. Select your test Plugin.
  8. Click 'Add Required'. In theory this shouldn't make any difference in startup times since Eclipse shouldn't be loading these extra plug-ins. In reality I can spot a one to two second difference

I strongly recommend creating one configuration for the each test plugin so that you can run all the tests for that plugin to see if changes you’ve made break any tests.

One last thought: Test plugins should be created as plug-in fragments to gain the benefit of being able to the benefit of package level access to the classes they’re testing.

BTW if you're getting tired of the Eclipse related stuff don't worry this will be the last for a while.

If you enjoyed this post, subscribe now to get free updates.

Read: Developing Eclipse RCP apps? Want access to Display etc will running your Unit Tests

Topic: Joined beyond Reality Previous Topic   Next Topic Topic: A Failure of Imagination

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use