Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How do I automatically set preferences for a test?
How do I automatically set preferences for a test? [message #806447] Sat, 25 February 2012 00:59 Go to next message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
Registered: July 2009
Senior Member
I have an SWTBot test plug-in which requires setting:

org.eclipse.ui.ide/SWITCH_PERSPECTIVE_ON_PROJECT_CREATION=always

I tried setting the preference using the Preferences view via SWTBot itself, but there is some glitch where the setting is made via SWTBot, but it is not set properly and this later breaks my tests.

Now, my tests work fine with the setting above in a plugin_customization.ini file which I have to specify via a -pluginCustomization argument in the Run dialog for my particular test.

I would like to make the test automatically do this for anyone who checks out the test plug-in from the repository without forcing them to set up the -pluginCustomization option. (i.e. just right-click and Run as..-> SWTBot test).

What would be the best way to do this?

I would also like to do this for Junit tests as well.
Re: How do I automatically set preferences for a test? [message #809110 is a reply to message #806447] Tue, 28 February 2012 13:44 Go to previous message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
You can do this programmatically. Get hold of the right
org.eclipse.jface.preference.IPreferenceStore and then set the value for
the right preference key via
org.eclipse.jface.preference.IPreferenceStore.setValue(String, boolean)

--
Deepak Azad
http://wiki.eclipse.org/JDT/FAQ
Previous Topic:Views order
Next Topic:Proposal: Jump to middle of current line - new key shortcut
Goto Forum:
  


Current Time: Fri Apr 19 04:08:05 GMT 2024

Powered by FUDForum. Page generated in 0.02018 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top