Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Running JUnit tests from a plugin
Running JUnit tests from a plugin [message #728574] Fri, 23 September 2011 13:44
h.a.gerhardt is currently offline h.a.gerhardtFriend
Messages: 1
Registered: September 2011
Junior Member
I'm trying to find a way to run 1 (later even more) JUnit-tests from a plugin.
At the moment, the only way I have found seems to be very cumbersome and does not quite look right:

ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfig = launchManager.getLaunchConfigurationType("org.eclipse.jdt.junit.launchconfig");
ILaunchConfigurationWorkingCopy workingCopy = launchConfig.newInstance(null, "name");
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "javaprojectname");
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "testclassname");
workingCopy.setAttribute("org.eclipse.jdt.junit.TEST_KIND", "org.eclipse.jdt.junit.loader.junit4");
ILaunchConfiguration config = workingCopy.doSave();
config.launch(ILaunchManager.RUN_MODE, null);


As you can see, I'm setting a lot of attributes with magic strings. Is there a better way to achieve this ?
Previous Topic:Export Product wizard from command line?
Next Topic:No schema found for the 'org.eclipse.core.resources.natures' extension point
Goto Forum:
  


Current Time: Fri Apr 26 10:53:12 GMT 2024

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

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

Back to the top