Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6811155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:17:34+00:00 2026-05-26T20:17:34+00:00

I am developing for Eclipse, and one feature is run JUnit tests. Now my

  • 0

I am developing for Eclipse, and one feature is run JUnit tests. Now my plugin detect JUnit tests on a project in workspace and after this I want to call JUnit to run this tests.

I heard about ILaunch, ILaunchConfigurationDelegate, JUnitLaunchConfigurationDelegate but I cannot found an example of this and also I’m not sure if I have to use this!

— Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:17:34+00:00Added an answer on May 26, 2026 at 8:17 pm

    Please see my answer to How does Eclipse actually run Junit tests?. You will need to create a Run Configuration and then call JUnitLaunchConfigurationDelegate#launch() with the configuration.

    The easiest way to do this is to add shortcuts to the extension point org.eclipse.debug.ui.launchShortcuts. With the correct configurationType, you can create the correct type and normally, Eclipse will do the rest. In fact this is exactly what we’ve done in the Scala IDE.

    Here is the relevant XML from scala-ide:

    <extension point="org.eclipse.debug.ui.launchShortcuts">
        <shortcut
              label="%JUnitShortcut.label"
              icon="$nl$/icons/full/obj16/julaunch.gif"
              helpContextId="org.eclipse.jdt.junit.launch_shortcut"
              class="org.eclipse.jdt.junit.launcher.JUnitLaunchShortcut"
              modes="run, debug"
              id="scala.tools.eclipse.scalatest.junitShortcut">
           <contextualLaunch>
              <enablement>
                 <with variable="selection">
                    <count value="1"/>
                    <iterate>
                       <adapt type="org.eclipse.jdt.core.IJavaElement">
                          <test property="org.eclipse.debug.ui.matchesPattern" value="*.scala"/>
                          <test property="org.eclipse.jdt.core.isInJavaProject"/>
                          <test property="org.eclipse.jdt.core.hasTypeOnClasspath" value="junit.framework.Test"/>
                          <or>
                          <test property="scala.tools.eclipse.launching.canLaunchAsJUnit" forcePluginActivation="true"/>
                          <test property="scala.tools.eclipse.launching.junit.canLaunchAsJUnit" forcePluginActivation="true"/>
                          </or>
                       </adapt>
                    </iterate>
                 </with>
              </enablement>
           </contextualLaunch>
           <configurationType
                 id="org.eclipse.jdt.junit.launchconfig">
           </configurationType>
           <description
                 description="%DebugJUnitLaunchShortcut.description"
                 mode="debug">
           </description>
           <description
                 description="%RunJUnitLaunchShortcut.description"
                 mode="run">
           </description>
        </shortcut>
    </extension>
    

    The important element is the <contextualLaunch>, which defines a set of tests which need to be true in order that the option to launch as JUnit be presented to the user. Most of these are self explanatory, but we’ve also scala.tools.eclipse.launching.canLaunchAsJUnit, which references an extension point org.eclipse.core.expressions.propertyTesters. These property testers test whether the code can be launched as JUnit or not (for instance, the class under test extends TestCase or whatever).

    If you need more details, I recommend downloading Scala IDE, and looking at the code, but it is written in Scala.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an Eclipse plugin that monitors events in the workspace. One of
I am developing an Eclipse plugin and have tests for it. Some are regular
i am developing a eclipse plugin . In this plugin i am using reflection
For you all information i am developing one java project using Eclipse to interact
I'm developing one web application, using PHP eclipse IDE. For an instance i want
currently I'm developing in eclipse 3.5 in different project web applications for tomcat 6.0.24.
I'm developing a an eclipse plugin that uses an SWT interface. I need to
I am developing one Blackberry application using Eclipse, I need to show images in
I am developing a simple android application using eclipse. I wrote a JUnit TestCase
I am developing a plugin in eclipse which can generate a text file (based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.