Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit5 Platform Launcher API - Cannot create Launcher without at least one TestEngine #1294

Closed
LucasBullen opened this issue Feb 12, 2018 · 5 comments

Comments

@LucasBullen
Copy link

LucasBullen commented Feb 12, 2018

Copying from StackOverflow due to inactivity: https://stackoverflow.com/questions/48672051/junit5-platform-launcher-api-cannot-create-launcher-without-at-least-one-teste

I am attempting to upgrade the testing abilities of our automated testing suite to accept JUnit5 tests and when following The JUnit Platform Launcher API instructions I get the error "Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath". The cause is that the following is unable to find any instances of TestEngine:

Iterable<TestEngine> testEngines = ServiceLoader.load(TestEngine.class,ClassLoaderUtils.getDefaultClassLoader());

Do you have any suggestions on how to ensure that the ServiceLoader is able to find an instance of TestEngine?

I have included org.junit.jupiter.engine, which contains JupiterTestEngine which implements TestEngine, as a required plugin. I have tried adding a direct path to the jupiter.engine JAR in the project's .classpath. I have tried creating an instance of JupiterTestEngine within the same file and it is created successfully, but still no TestEngines found by the service loader.

This is for Eclipse and you can see the code base here:
http://git.eclipse.org/c/platform/eclipse.platform.releng.git/tree/bundles/org.eclipse.test

I added the following to the manifest:

    org.junit.platform.launcher,
    org.junit.jupiter.api;bundle-version="5.0.0",
    org.junit.platform.engine;bundle-version="1.0.0",
    org.junit.platform.commons;bundle-version="1.0.0",
    org.junit.jupiter.engine;bundle-version="5.0.0",
    org.junit.vintage.engine;bundle-version="4.12.0"

Added this to the .classplath:
<classpathentry exported="true" kind="lib" path="/home/lbullen/Documents/eclipse/plugins/org.junit.jupiter.engine_5.0.0.v20170910-2246.jar"/>

Added the org.junit.jupiter.engine JAR to the lib folder then added it to be included in the binary build. (I'm stretching for a solution)

And I'm trying to get the Tutorial code to work in an edited version of http://git.eclipse.org/c/platform/eclipse.platform.releng.git/tree/bundles/org.eclipse.test/src/org/eclipse/test/EclipseTestRunner.java with all the old JUnit code removed and LauncherFactory.create(); added to the EclipseTestRunner constructor.

@sbrannen
Copy link
Member

sbrannen commented Feb 12, 2018

Have you considered asking your question within the Eclipse issue tracker?

I imagine someone there could help you much better than we can. 😉

@noopur2507, thoughts?

@LucasBullen
Copy link
Author

Overarching issue being tracked here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=531057

@sbrannen
Copy link
Member

Overarching issue being tracked here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=531057

Thanks

@noopur2507
Copy link

It can be tracked further in the Eclipse bug.

@sbrannen
Copy link
Member

It can be tracked further in the Eclipse bug.

Thanks! 🙇

I'll close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants