简体   繁体   中英

Java >9, Cucumber and JUnit5 execution for a non spring app

Hello dear stackoverflowers

Dealing with the Cucumber docs and a lot of "googleizing", I still stay stuck with the Maven, Java, Junit5 and Cucumber and some java modules integration (with a JDK18).

Having a very simple java desktop application (yes, I know this odd), I am trying to get my cucumber's features executed from maven (with the help of surefire.

Here is my simplified pom.xml file.

I think I have no more issues on the Java Module side as there is no 'illegal access" error.

But having an (I hope) clear configuration, I am not able to get the feature tests executed, nothing happened at 'surefire' side:

--- maven-surefire-plugin:3.0.0-M7:test (default-test) @ usecasetdd ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]

And the Cucumber "bootstraper":

package com.demodemo.core.tests;

//...

@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("com/demodemo/core/tests/features")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.demodemo.core.tests")
class GameBDDTests {
}

And the structure of my project is as below:

项目工作树结构

Maybe I've done a basic error, but even digging the web, I've not found it... Is there a way to make that work, or no chance to achieve that? Could you help?

Anyway, thanks for any help you will be able to offer on this not so simple topic.

Very best regards,

McG.

You should define only the following as dependencies and don't use properties because all the dependencies of junit jupiter are defined via the bom file..

<dependency>
  <groupId>org.junit.platform</groupId>
  <artifactId>junit-platform-suite-engine</artifactId>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.junit.jupiter</groupId>
  <artifactId>junit-jupiter-engine</artifactId>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>io.cucumber</groupId>
  <artifactId>cucumber-junit-platform-engine</artifactId>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>io.cucumber</groupId>
  <artifactId>cucumber-java8</artifactId>
  <scope>test</scope>
</dependency>

There is no need for supplemental version properties or alike. The cucumber parts are also defined via cucumber bom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM