Skip to content

Support registering JUnit tester runnable as a service to be run by custom code #6960

@ejjcase

Description

@ejjcase

In biz.aQute.tester.junit-platform I can choose to run the tests on their own thread (the default behaviour) or register them as a service. If they are registered as a service, the service always has the attribute main.thread=true, which means aQute.launcher.Launcher picks it up and runs it on the main thread.

I would like the option to register the service without main.thread=true so that I can run it at a different time.

Motivation: I am migrating an old RCP application to Bnd. It has many tests (thousands) that rely on the workbench being up and running, and/or which need to run in the Eclipse UI thread. So I would like to hook into Eclipse's support for workbench tests by obtaining the tester Runnable and then doing this:

PlatformUI.getTestableObject().setTestHarness(() -> Display.getDefault().asyncExec(runnable));

Simply omitting main.thread=true from the service registration is enough to make this work, because then I can find the service by filtering on (&(objectclass=java.lang.Runnable)(service.description=JUnit tester)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions