Giter Site home page Giter Site logo

quarkus-cucumber's Introduction

Welcome to Quarkiverse Hub!

The Quarkiverse GitHub organization provides repository hosting (including build, CI and release publishing setup) for Quarkus extension projects contributed by the community.

This repository serves several functions:

Onboarding an extension

Looking to onboard an extension? Here's the quick link.

Updating the docs

The content for the Quarkiverse Hub site lives in the docs folder. It is mirrored to the GitHub wiki, and also published externally as a Gatsby site. This allows the content to be indexed by search engines, and also enables richer formatting and styling.

Run project locally

To stand up the Gatsby site locally, work in the site directory. First, install the required dependencies:

npm install

Then, to start development:

npm run develop

Gatsby will start a hot-reloading development environment at localhost:8000

quarkus-cucumber's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quarkus-cucumber's Issues

Alternative Beans not properly resolved

Expected result

The alternative Bean with higher priority is chosen.
The injected AuthorizationController is the customCustomOidcTestAuthController (see below).

Observed result

The injected AuthorizationController is the default TestAuthController.
Seen from the debugger:
image
by using

@Inject
AuthorizationController authorizationController;

in the class inheriting fromCucumberQuarkusTest.

Misc

In other test classes this works perfectly fine, just in our cucumber quarkus tests is does not work.

The CustomOidcTestAuthController class:

@Alternative
@Priority(Interceptor.Priority.LIBRARY_BEFORE + 1)
@ApplicationScoped
public class CustomOidcTestAuthController extends TestAuthController {

    @Override
    public boolean isAuthorizationEnabled() {
        return false;
    }
}

(hint: Interceptor.Priority.LIBRARY_BEFORE is 1000, the TestAuthController has 3000)

Only scenarios should be considered as Tests (starting/ending cucumber and beforeFeature methods should not)

Hello,
As a new user of this quarkus extension, I expected to see only my scenarios as tests launched, but it seems that cucumber specific actions (starting/ending cucumber, before/after methods) are shown as separate tests also.

After reading code in CucumberQuarkusTest, this behavior is due to creation of DynamicTests for start/end of cucumber, and beforeFeature) :

features.add(DynamicTest.dynamicTest("Start Cucumber", context::startTestRun));

tests.add(DynamicTest.dynamicTest("Start Feature", () -> context.beforeFeature(f)));

features.add(DynamicContainer.dynamicContainer(f.getName().orElse(f.getSource()), tests.stream()));

I may understand that's done in order to see each step separately, but this is causing the following issues when generating Junit surefire/failsafe reports:

  1. The number of tests shown is not correct
  2. Showing tests that are not really ones

In order to solve this issue, we my proceed as following:

  1. Create beforeAll and afterAll methods that will be responsible for starting/ending cucumber (in order to declare them as non static, we may need to add the following annotation: @TestInstance(TestInstance.Lifecycle.PER_CLASS)
  2. Include call to beforeFeature inside call of pickles (DynamicTests)

If you agree with this proposal, I can suggest a patch.

Thank you

Execution of multiple tests not possible due to terminated state

I'm using the Quarkus Cucumber extension in version 1.0.0. I've added two tests with different steps, scenarios, etc.. Both test classes are extending from CucumberQuarkusTest.

Everything is running fine when only one test class is executed.

But when two CucumberQuarkusTest test classes are executed (e.g. via Intellij -> Run Test) only the first test is executed. The second one is already in "Terminated" state without running any tests. There's no exception visible on console.

The same behavior is when some other @QuarkusTest annotated tests are executed together with a CucumberQuarkusTest. All tests before the CucumberQuarkusTest are executed fine, the CucumberQuarkusTest itself is also executed fine. But tests after that CucumberQuarkusTest are again directly in terminated state without any error message.

When executing all tests running mvn clean install (test execution is configured with surefire-plugin) then all tests are executed without problems.

Is there any configuration option I am missing, which enables the execution of multiple BDD tests within a single run?

Runner file

I don't have the option to perform a pull request (company restriction), so I write here instead.

I added so the user have the option to define Steps and Feature files from a "runner file":

        runtimeOptionsBuilder.addGlue(URI.create("classpath:/" + stepsPath));
        runtimeOptionsBuilder.addFeature(FeatureWithLines.create(URI.create("classpath:/" + featurePath), Collections.emptyList()));

        if (tags != null)
        {
            for (String tag : tags)
            {
                runtimeOptionsBuilder.addTagFilter(TagExpressionParser.parse(tag));
            }
        }

And then implemented some setters:

   public void setGlue(String stepsPath)
    {
        this.stepsPath = stepsPath;
    }

    public void setFeature(String featurePath)
    {
        this.featurePath = featurePath;
    }

    public void setTag(String tags)
    {
        this.tags = Arrays.asList(tags.split("\\s*,\\s*"));
    }

in order for my "runner" class to look like this:

@QuarkusTest
public class HelloRunner extends CucumberQuarkusTest
{
    @BeforeEach
    public void setup()
    {
        super.setGlue("ekn/information/hellocucumber");
        super.setFeature("Hello.feature");
        super.setTag("@smoke");
    }
}

I used the logics applied by @drubio-tlnd in https://github.com/quarkusio/quarkus/issues/11045#issuecomment-769663017, which works if only one tag is used, but fails when there are many tags. Any idea why?

Allow to run each Feature/Scenario with a fresh quarkus app

With standard quarkus tests, is it possible to configure profiles and get the quarkus app to be restarted when the profile changes.

It would be nice to have a way to configure the lifecycle of the quarkus app to get it bound to the test entire suite, the features or scenarios so as example, each feature would trigger the re-deploy of the quarkus app.

As today, the only way to achieve that is by creating a number of tests class where each one explicitly configures the features to include, like:

@CucumberOptions(features = { "classpath:My.feature"  })
@TestProfile(MyTest.Profile.class)
public class MyTest extends CucumberQuarkusTest {
    public static class Profile implements QuarkusTestProfile {
        @Override
        public Map<String, String> getConfigOverrides() {
            return Map.of(
                "test.namespace", uid());
        }
    }
}

Add possibility to extend method CucumberQuarkusTest.getTests

Hello,

I am currently using this quarkus extension, and when I had a look at the Junit surefire report, it seems that all tests (scenarios) are named "getTests"
In order to make the surefire report more accurate, I tried to configure the surefire maven plugin in this way :

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>3.1.2</version>
  <configuration>
	  <statelessTestsetReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter">
		  <usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
	  </statelessTestsetReporter>
  </configuration>
</plugin>

After doing this, I have the following test names : <FeatureName>getTests<Scenario>

So in order to not see the "getTests" in the report, I needed to use the @DisplayName(": Scenario: ") from Junit5 to have a test name more accurate, but I was not able to do so since the CucumberQuarkusTest.getTests method is package private.

Is it possible to make this method protected ?
In case you are interested also by using the @DisplayName(": Scenario: ") (or something close), this will help me to have less code on my side also.

Thank you in advance for your feedback

Running cucumber scenarios in parallel?

Can you please advise if it is possible to run quarkus-cucumber extension tests in parallel mode?

When I try to setup Junit and Cucumber to run in parallel mode at scenario level, I am getting below errors:

@Local
Scenario: Test 2                               # src/test/resources/feature/Local.feature:10
  Given this scenario is running
  When I do something
  Then It should execute along other scenarios # com.mulgish.bdd.Steps.itShouldExecuteAlongOtherScenarios()
[ERROR] Tests run: 5, Failures: 1, Errors: 2, Skipped: 0, Time elapsed: 6.272 s <<< FAILURE! - in com.mulgish.bdd.CucumberTestIT
[ERROR] com.mulgish.bdd.CucumberTestIT.getTests  Time elapsed: 0.002 s  <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.time.temporal.Temporal.until(java.time.temporal.Temporal, java.time.temporal.TemporalUnit)" because "startInclusive" is null
	at java.base/java.time.Duration.between(Duration.java:490)
	at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:109)
	at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:98)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$0(DynamicTestTestDescriptor.java:53)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptDynamicTest(QuarkusTestExtension.java:924)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:184)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:61)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:167)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:184)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:61)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:60)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:32)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
	at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

[ERROR] com.mulgish.bdd.CucumberTestIT.getTests  Time elapsed: 0.036 s  <<< ERROR!
io.cucumber.core.runner.DuplicateStepDefinitionException: Duplicate step definitions in com.mulgish.bdd.Steps.iDoSomething() and com.mulgish.bdd.Steps.iDoSomething()
	at io.cucumber.core.runner.CachingGlue.lambda$prepareGlue$3(CachingGlue.java:278)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at io.cucumber.core.runner.CachingGlue.prepareGlue(CachingGlue.java:272)
	at io.cucumber.core.runner.Runner.runPickle(Runner.java:72)
	at io.quarkiverse.cucumber.CucumberQuarkusTest.lambda$getTests$6(CucumberQuarkusTest.java:140)
	at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:129)
	at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
	at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:129)
	at io.quarkiverse.cucumber.CucumberQuarkusTest.lambda$getTests$7(CucumberQuarkusTest.java:140)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$0(DynamicTestTestDescriptor.java:53)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptDynamicTest(QuarkusTestExtension.java:924)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:184)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:61)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:167)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:184)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:61)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:60)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:32)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
	at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

[ERROR] com.mulgish.bdd.CucumberTestIT.getTests  Time elapsed: 0.079 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: failed in file:///home/sandbox/IdeaProjects/quarkus-cucumber-parallel-example/src/test/resources/feature/Local.feature at line 11
	at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:43)
	at org.junit.jupiter.api.Assertions.fail(Assertions.java:146)
	at io.quarkiverse.cucumber.CucumberQuarkusTest.lambda$getTests$7(CucumberQuarkusTest.java:145)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$0(DynamicTestTestDescriptor.java:53)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptDynamicTest(QuarkusTestExtension.java:924)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:184)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:61)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:167)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:184)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:61)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:60)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:32)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
	at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinTask.awaitDone(ForkJoinTask.java:436)
	at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:979)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.awaitFinished(NodeTestTask.java:236)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:158)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
	at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
[ERROR] Errors: 
[ERROR] com.mulgish.bdd.CucumberTestIT.getTests
[ERROR]   Run 1: CucumberTestIT.getTests » NullPointer Cannot invoke "java.time.temporal.Temporal.until(java.time.temporal.Temporal, java.time.temporal.TemporalUnit)" because "startInclusive" is null
[INFO]   Run 2: PASS
[INFO]   Run 3: PASS
[ERROR]   Run 4: CucumberTestIT>CucumberQuarkusTest.lambda$getTests$7:140->CucumberQuarkusTest.lambda$getTests$6:140 » DuplicateStepDefinition Duplicate step definitions in com.mulgish.bdd.Steps.iDoSomething() and com.mulgish.bdd.Steps.iDoSomething()
[ERROR]   Run 5: CucumberTestIT>CucumberQuarkusTest.lambda$getTests$7:145 failed in file:///home/sandbox/IdeaProjects/quarkus-cucumber-parallel-example/src/test/resources/feature/Local.feature at line 11

My code + configuration

CucumberTestIT.java
@CucumberOptions(features = "src/test/resources/feature/Local.feature", plugin = "json:target/cucumber-report/Report.json", tags="not @Ignore")
public class CucumberTestIT extends CucumberQuarkusTest   {
    public static void main(String[] args) {
        runMain(CucumberTestIT.class, args);
    }
}
Local.feature
@Local
Feature: Testing parallelism


  Scenario: Test 1
    Given this scenario is running
    When I do something
    Then It should execute along other scenarios

  Scenario: Test 2
    Given this scenario is running
    When I do something
    Then It should execute along other scenarios
Steps.java
public class Steps {

    private static final Logger LOGGER = LoggerFactory.getLogger(Steps.class);

    String scenarioName;

    @Before
    public void setup(Scenario scenario) {
        scenarioName = scenario.getName();
    }

    @Given("this scenario is running")
    public void thisScenarioIsRunning() {
        LOGGER.info("Running scenario " + scenarioName);
    }

    @When("I do something")
    public void iDoSomething() throws InterruptedException {
        Thread.sleep(1000);
    }

    @Then("It should execute along other scenarios")
    public void itShouldExecuteAlongOtherScenarios() {
        LOGGER.info("I hope {} scenario is running in parallel!", scenarioName);
    }

}
pom.xml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>3.0.0-M7</version>
    <configuration>
        <systemProperties>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
        </systemProperties>
        <properties>
            <configurationParameters>
                cucumber.execution.parallel.enabled = true
                junit.jupiter.execution.parallel.enabled = true
                junit.jupiter.execution.parallel.mode.default = concurrent
                junit.jupiter.execution.parallel.mode.classes.default = same_thread
            </configurationParameters>
        </properties>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>integration-test</goal>
            </goals>
        </execution>
    </executions>
</plugin>

If I remove parallel configuration under configurationParameters, everything works as expected but sequentially.

@Local
Scenario: Test 1                               # src/test/resources/feature/Local.feature:5
  Given this scenario is running               # com.mulgish.bdd.Steps.thisScenarioIsRunning()
2022-09-06 23:47:58,875 INFO  [com.lgi.bdd.Steps] (main) Running scenario Test 1
  When I do something                          # com.mulgish.bdd.Steps.iDoSomething()
  Then It should execute along other scenarios # com.mulgish.bdd.Steps.itShouldExecuteAlongOtherScenarios()
2022-09-06 23:47:59,887 INFO  [com.lgi.bdd.Steps] (main) I hope Test 1 scenario is running in parallel!

@Local
Scenario: Test 2                               # src/test/resources/feature/Local.feature:10
  Given this scenario is running               # com.mulgish.bdd.Steps.thisScenarioIsRunning()
2022-09-06 23:47:59,892 INFO  [com.lgi.bdd.Steps] (main) Running scenario Test 2
  When I do something                          # com.mulgish.bdd.Steps.iDoSomething()
  Then It should execute along other scenarios # com.mulgish.bdd.Steps.itShouldExecuteAlongOtherScenarios()
2022-09-06 23:48:00,897 INFO  [com.lgi.bdd.Steps] (main) I hope Test 2 scenario is running in parallel!

2 Scenarios (2 passed)
6 Steps (6 passed)
0m2.067s

Process finished with exit code 0

A working example of a Uni test

Following from this issue question where I was very much off track, I now have a working example of testing a Uni of type POJO / Bean.

This is very much a "getting started" example.

I am posting all this for newcomers like me. There were some "gotchas" along the way. ;-)

Any refinements and suggestions would be gratefully received.

(As an aside: To help others who are as new as I am, and who might stumble on this post, I have included the folder structure screenshot (VSCode) because it took me a while to work out where the files should go. It is obvious now, but wasn't when I was starting out. ;-) )
Greenshot 2022-10-20 18 40 14

The test_my_greeting.feature file:

Feature: Test My Greeting Service

  Scenario: Test Greeting
    Given my name is "<name>"
    When I send a greeting
    Then the reply should be "<reply>"

    Examples:
      | name  | reply                         |
      | fred  | Hello fred                    |
      | sally | Hello sally                   |
      | kim   | Sorry, kim, I don't know you. |

      # This one should fail
      | kim   | Who dat?                      |

The TestRunner.java file:

package org.acme;

import io.quarkiverse.cucumber.CucumberOptions;
import io.quarkiverse.cucumber.CucumberQuarkusTest;
import io.quarkus.test.junit.main.QuarkusMainTest;

@QuarkusMainTest

// The standard Cucumber for JVM options.
@CucumberOptions(
  // The root path to say where the feature files are located.
  features = { "src/test/resources" },

  // The formatter.
  // html:target refers to the /target folder in your java project
  // so the report will be /target/cucumber-reports/report.html
  plugin = { "pretty", "html:target/cucumber-reports/report.html" }
)
public class TestRunner extends CucumberQuarkusTest {
  public static void main(String[] args) {
    runMain(TestRunner.class, args);
  }
}

Again, for newbies: you can view the report.html in your browser by using the Finder / File Manager at eg: file:///Path/To/Your/Project/target/cucumber-reports/report.html

The GreetingService.java file:

package org.acme;

import javax.enterprise.context.ApplicationScoped;

import io.smallrye.mutiny.Uni;

@ApplicationScoped
public class GreetingService {
  public String greeting (String name) {
    if ("fred,sally".contains(name)) {
      return "Hello " + name;
    } else {
      return "Sorry, " + name + ", I don't know you.";
    }
  }

  public Uni<String> greetingUni (String name) {
    return Uni.createFrom().item(greeting(name));
  }

  public Uni<Packet> greetingPacketUni (String name) {
    Packet packet = new Packet();
    packet.setSuccess(true);
    packet.setAction("greet");

    // Calculate the greeting message and set it
    packet.setMessage(greeting(name));

    return Uni.createFrom().item(packet);
  }
}

The Packet.java POJO / Bean file:

package org.acme;

public class Packet {
  Boolean success = false;
  String message = "";
  String data = "";
  String action = "";

  // Getters and Setters here ...

  @Override
  public String toString() {
    return "action=" + this.getAction() + ", success=" + this.getSuccess() + ", data=" + this.getData() + ", message=" + this.getMessage();
  }

  @Override
  public boolean equals(Object o) {
    // Note for newbies like me:
    // Without this override Java will always return false for equals()
    // when comparing the expected Packet and the one we get from the Uni,
    // even when the properties are identical.
    // You need to tell the JVM what "equals" actually means in this context.

    // The reason is:
    // Mutiny .assertItem() in your THEN clause eventually calls item.equals(expected) in
    // io.smallrye.mutiny.helpers.test.AssertionHelper.shouldHaveReceived()
    // and this override is what is used to determine equality.

    if (this == o) {
      return true;
    }

    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    Packet o1 = (Packet) o;

    // Note: The properties you include for equality testing are up to you.
    // The other props could differ but you are only testing the "message" prop here.

    // Do the String comparison on the message.
    Boolean eq = message.equals(o1.message);

    // Just FYI
    System.out.println("Packet CHECK EQ=" + eq + " for <" + message + "> <" + o1.message + ">");

    return eq;
  }
}

And finally, the TestGreeting.java file:

package org.acme;

import static org.junit.jupiter.api.Assertions.assertEquals;

import javax.inject.Inject;

import io.cucumber.java.en.*;
import io.smallrye.mutiny.Uni;
import io.smallrye.mutiny.helpers.test.UniAssertSubscriber;

public class TestGreeting {
  @Inject
  GreetingService greetingService;

  String testName = "";

  UniAssertSubscriber<Packet> assertSubscriberPacketUni = null;

  Uni<Packet> greetingPacketUni = null;

  @Given("my name is {string}")
  public void my_name_is(String name) {
    testName = name;
    System.out.println("GIVEN with " + testName);
  }

  @When("I send a greeting")
  public void i_send_a_greeting() {
    System.out.println("WHEN with " + testName);

    // Create the Uni to be tested
    Uni<Packet> greetingPacketUni = greetingService.greetingPacketUni(testName);

    // Subscribe with the UniAssertSubscriber, which runs the Uni under test
    assertSubscriberPacketUni = greetingPacketUni.subscribe().withSubscriber(UniAssertSubscriber.create());
  }

  @Then("the reply should be {string}")
  public void the_reply_should_be(String reply) {
    System.out.println("THEN for " + testName + " expected reply to be: " + reply);

    // Build an expected Packet. For this example we will assume only the "reply" prop changes.
    Packet expectedPacket = new Packet();
    expectedPacket.setSuccess(true);
    expectedPacket.setAction("greet");
    expectedPacket.setMessage(reply); // <== from the feature file example

    // Do the assertion.
    // Compare the Packet item returned from the Uni under test to the expected one we just created above.
    // Note: See the equals() override and comment in Packet.java
    // Note: Mutiny 1.7.0 docs are not correct: as per: https://github.com/smallrye/smallrye-mutiny/discussions/1057
    // We need to use awaitItem() instead of assertCompleted()
    // ie not: assertSubscriberPacketUni.assertCompleted().assertItem(expectedPacket);
    // but instead:
    assertSubscriberPacketUni.awaitItem().assertItem(expectedPacket);
  }
}

And this is what it looks like in the report.html file:
Greenshot 2022-10-20 19 07 27

Again, any suggestions are welcome.
Cheers,
Murray

Feature Request/ Question: Run tests as Integration Tests

I feel that Cucumber lends itself to integration type testing. I believe, based on observation, that the tests run by this extension are run in a 'regular' test manner.

It would be fantastic for there to be a way to configure these tests to be run in an integration context.

For Maven, I imagine it would be a matter of tweaking the pom, but unsure what it would take in Gradle

Add support for uri linking per feature and scenario

Currently, dynamic tests don't backlink to a location of scenario or feature.
image
Here I can't locate a file where this feature is defined. It makes the whole process frustrating. It locates me to the main test file that defines those tests:
image

Quarkus Continuous Testing re-runs all Features/Scenarios, although "only failed tests" is selected

Hello everyone,

I tried out the Quarkus Dev UI and Continuous Testing, which feels great so far. The Dynamic Test Cases that are created by the getTests() method seem to get the Dev UI in trouble. I will create and link a separate issue for that.

Also, when some of the scenarios fail and I choose "re-run only failed" via Dev UI or command line, all features are re-run.
Since my project has a lot of features/scenarios, that slows down Continuous Testing massively in my case.

expected behavior:
Only scenarios that failed are re-run when "only failed" is chosen

actual behavior:
All scenarios are re-run if at least one scenario failed

----------- info on debugging:

I set a breakpoint in CucumberQuarkusTest::getTests and navigated the stack back to io.quarkus.deployment.dev.testing.JunitTestRunner.

These are all discovered Tests IDs:
image

  1. @TestFactory annotated method in Cucumber Mail Test class (the one with @CucumberOptions and so on.) extending CucumberQuarkusTest
  2. simple Jupiter Unit Tests
  3. idk ;)
  4. the class from 1. -> recognized via @QuarkusTest I guess
  5. more Unit Tests

When all tests are run, the internal state of JunitTestRunner has no additionalFilter set:
image

When only failed tests are re-run, there is a filter set:
image

The Quarkus Testing library seems to recognize the filter, maybe that can be used to filter dynamic tests in getTests()? I don't know how to access that state though.

I can contribute if you want and point me in the right direction.

Thank you
Eric

getTests() displayName must not be null or blank

Hello,

I have this error when I launch test with quarkus-cucumber:

╷
└─ JUnit Jupiter ✔
   └─ ExampleTest ✔
      └─ getTests() ✘ displayName must not be null or blank

Failures (1):
  JUnit Jupiter:ExampleTest:getTests()
    MethodSource [className = 'com.example.ExampleTest', methodName = 'getTests', methodParameterTypes = '']
    => org.junit.platform.commons.PreconditionViolationException: displayName must not be null or blank
       org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:281)
       org.junit.platform.commons.util.Preconditions.notBlank(Preconditions.java:249)
       org.junit.jupiter.api.DynamicNode.<init>(DynamicNode.java:39)
       org.junit.jupiter.api.DynamicTest.<init>(DynamicTest.java:232)
       org.junit.jupiter.api.DynamicTest.dynamicTest(DynamicTest.java:63)
       io.quarkiverse.cucumber.CucumberQuarkusTest.lambda$getTests$8(CucumberQuarkusTest.java:131)
       java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
       java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
       java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
       java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
       [...]

Support for Cucumber Java 8 Lambda Definitions

Are the Java 8 style bindings supported with Quarkus-Cucumber?

When I try to define my StepDefs as such:

class ApiStepDefs : En {
  init {
    Given("A GET request to the API") {
     // code goes here
    }

    When("We execute the request to the {string} endpoint") { endpoint:String ->
      // code goes here
    }

    Then("We get a blank list as a response") {
      // more code here
    }
  }
}

The test errors out as if the stepdefs were undefined

Undefined scenarios:
classpath:com/example/features/integration/Api.feature:5 # Calling the GET the api without prior initialization returns a blank list

1 Scenarios (1 undefined)
3 Steps (2 skipped, 1 undefined)
0m0.091s

For completeness, the feature file is:

# Created by Dev at 2022-11-15
Feature: An API
  Details the API behaviour

  Scenario: Calling the GET the api without prior initialization returns a blank list
    Given A GET request to the API
    When We execute the request to the "/endpoint" endpoint
    Then We get a blank list as a response

and the Runner stub

package com.michelin.pmu.dojo.features.integration

import io.quarkiverse.cucumber.CucumberOptions
import io.quarkiverse.cucumber.CucumberQuarkusTest

@CucumberOptions(
  plugin = ["pretty", "summary", "me.jvt.cucumber.report.PrettyReports:build/reports/cucumber/integration"]
)
class RunCucumberApiTests : CucumberQuarkusTest()

The features, stepdefs and runner are all in the same package.

How to fail a step when testing a Uni?

Hi.
Thanks for your extension. :-)

I am pretty new to Java and Quarkus but have used Cucumber in Javascript.

I want to test a class via a method that returns a Uni. I have devised the following setup to learn how to use Cucumber with Quarkus and it almost works.

The issue I am having is the intentional failure of the 4th line of the example data which I hoped would cause Cucumber to report a failing test. However, instead I am getting a passing result and the message:

Mutiny had to drop the following exception: org.opentest4j.AssertionFailedError: expected: <Sorry, kim, I don't know you.> but was: <Who dat?>

The second question is: Is this the best way to go about structuring a Uni test? I could not find an example anywhere.

(As an aside: To help others who are as new as I am, and who might stumble on this post, I have included the folder structure screenshot (VSCode) because it took me a while to work out where the files should go. It is obvious now, but wasn't when I was starting out. ;-) )
Greenshot 2022-10-17 15 22 47

The test_my_greeting.feature file:

Feature: Test My Greeting Service

  Scenario: Test Greeting
    Given my name is "<name>"
    When I send a greeting
    Then the reply should be "<reply>"

    Examples:
      | name  | reply                         |
      | fred  | Hello fred                    |
      | sally | Hello sally                   |
      | kim   | Sorry, kim, I don't know you. |

      # This one should fail
      | kim   | Who dat?                      |

The TestRunner.java file:

package org.acme;

import io.quarkiverse.cucumber.CucumberOptions;
import io.quarkiverse.cucumber.CucumberQuarkusTest;
import io.quarkus.test.junit.main.QuarkusMainTest;
//import org.junit.runner.RunWith;

@QuarkusMainTest

@CucumberOptions(features = { "src/test/resources" }, plugin = { "pretty", "html:target/cucumber-reports/report.html" })
public class TestRunner extends CucumberQuarkusTest {
  public static void main(String[] args) {
    runMain(TestRunner.class, args);
  }
}

(Again, for newbies: you can view the report.html in your browser by using the Finder / File Manager at eg: file:///Path/To/Your/Project/target/cucumber-reports/report.html)

The GreetingService.java file:

package org.acme;

import javax.enterprise.context.ApplicationScoped;

import io.smallrye.mutiny.Uni;

@ApplicationScoped
public class GreetingService {
  public String greeting (String name) {
    if ("fred,sally".contains(name)) {
      return "Hello " + name;
    } else {
      return "Sorry, " + name + ", I don't know you.";
    }
  }

  public Uni<String> greetingUni (String name) {
    return Uni.createFrom().item(greeting(name));
  }
}

And finally, the TestGreeting.java file:

package org.acme;

import static org.junit.jupiter.api.Assertions.assertEquals;

import javax.inject.Inject;

import io.cucumber.java.en.*;
import io.quarkus.logging.Log;
import io.smallrye.mutiny.Uni;

public class TestGreeting {
  @Inject
  GreetingService greetingService;

  String testName = "";
  Uni<String> greetingUni = null;

  @Given("my name is {string}")
  public void my_name_is(String name) {
    testName = name;
    System.out.println("GIVEN with " + testName);
  }

  @When("I send a greeting")
  public Uni<String> i_send_a_greeting() {
    System.out.println("WHEN with " + testName);

    greetingUni = greetingService.greetingUni(testName);
    return greetingUni;
  }

  @Then("the reply should be {string}")
  public void the_reply_should_be(String reply) {
    System.out.println("THEN for " + testName + " expected reply to be: " + reply);

    greetingUni.subscribe().with(
        greetingReply -> {
          System.out.println("greetingService.greetingUni greetingReply=" + greetingReply);
          
          // This throws the org.opentest4j.AssertionFailedError on example 4 
          // but Mutiny "drops" it, so the test passes.
          assertEquals(greetingReply, reply);
        },
        failure -> {
          Log.error("greetingService.greetingUni failed=" + failure.toString());
        });
  }
}

Any suggestions on how all this should be done would be gratefully received. :-)

Cheers,
Murray

Dependency is null when injected in Step definition classes

I have a step definition and i need to inject a dependency of a repository , but the repository is null.

@ApplicationScoped
@Unremovable
@DBUnitInterceptor
public class Steps{
    @Inject
    SomeRepository repository;
    
    @DataSet(value = "seed_my_data.yml")
    @Given("user {string} submitted a request with id {string} and service {string} and type {string}")
    public void user_submitted_a_request_with_id_and_service_and_type(String userName, String id, String service, String type) {
 
        Request request = repository.findById(id);
    }

The same repository is injected without problems in other non-cucumber tests that are marked with @QuarkusTest

Test runner class is as follows:

public class RunCucumberTest extends CucumberQuarkusTest {
}

Expected injected dependency inside the step class to be an instantiated object
Actual dependency is null

Where should I put the @BeforeAll and @AfterAll ?

Hi. I cant seem to get @BeforeAll working.

I tried like this

import io.quarkiverse.cucumber.CucumberOptions;
import io.quarkiverse.cucumber.CucumberQuarkusTest;
import io.quarkus.test.junit.main.QuarkusMainTest;
import io.cucumber.java.BeforeAll;

@QuarkusMainTest

@CucumberOptions(
  features = { "src/test/resources" },
  plugin = { "pretty", "html:target/cucumber-reports/report.html" }
)
public class TestRunner extends CucumberQuarkusTest {
  @BeforeAll
  public static void beforeAll() {
    System.out.println("============= BEFORE ALL ==============");
  }

  public static void main(String[] args) {
    runMain(TestRunner.class, args);
  }
}

How should it be done? Do I need a support file somewhere? or?

Thanks,
Murray

Failure if used with quarkus-datadog-opentracing

Hello, I'm using IntelliJ and I can't run Cucumber tests with quarkus-datadog-opentracing unless i add:

-Djava.util.logging.manager=org.jboss.logmanager.LogManager

as VM options on Run Configurations in my IDE. A very similar issue is here: quarkusio/quarkus#9339

This is the exception I receive if I don't add the configuration:

╷
└─ JUnit Jupiter ✔
   └─ CucumberIT ✔
      └─ getTests() ✘ java.lang.RuntimeException: Failed to start quarkus

Failures (1):
  JUnit Jupiter:CucumberIT:getTests()
    MethodSource [className = 'xx.CucumberIT', methodName = 'getTests', methodParameterTypes = '']
    => java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
       io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:632)
       io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:703)
       org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
       org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
       org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestClassConstructor(InvocationInterceptor.java:73)
       [...]
     Caused by: java.lang.RuntimeException: Failed to start quarkus
       io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
       io.quarkus.runtime.Application.start(Application.java:101)
       java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
       java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       [...]
     Caused by: java.lang.ExceptionInInitializerError
       io.quarkiverse.opentracing.datadog.DatadogTracerInitializer_Bean.create(Unknown Source)
       io.quarkiverse.opentracing.datadog.DatadogTracerInitializer_Bean.create(Unknown Source)
       io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:111)
       io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
       io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:32)
       [...]
     Caused by: java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
       org.jboss.logmanager.Logger.getLogger(Logger.java:57)
       io.quarkiverse.opentracing.datadog.DatadogTracerInitializer.<clinit>(DatadogTracerInitializer.java:19)
       [...]

Quarkiverse OpenTracing dependency:

    <dependency>
      <groupId>io.quarkiverse.opentracing.datadog</groupId>
      <artifactId>quarkus-datadog-opentracing</artifactId>
      <version>1.1.4</version>
    </dependency>

Execute cucumber test from custom module

Hi,

I am trying to execute cucumber test from custom/another module than test however facing issue.

java.lang.IllegalStateException: Unable to locate CDIProvider
	at javax.enterprise.inject.spi.CDI.findAllProviders(CDI.java:121)
	at javax.enterprise.inject.spi.CDI.getCDIProvider(CDI.java:82)
	at javax.enterprise.inject.spi.CDI.current(CDI.java:64)
	at io.quarkiverse.cucumber.CucumberQuarkusTest$CdiObjectFactory.getInstance(CucumberQuarkusTest.java:184)

Not sure how to provide CDI to custom module. Any help on this would be appreciated.

I am able to execute cucumber test from test module however I want to separate it from JUnits.

Sample code:
demo.zip

I am trying to execute cucumber test (health endpoint) against a running instance.

image

NoClassDefFoundError with Version 1.0.0

Hello, we're using Quarkus 2.9.2 Final with Java 17.

I've just upgraded Quarkus Cucumber from 0.6.0 to 1.0.0. This is the exception I receive on the version 1.0.0 when I run any Cucumber test:

Step failed
java.lang.NoClassDefFoundError: jakarta/enterprise/inject/spi/CDI
	at io.quarkiverse.cucumber.CucumberQuarkusTest$CdiObjectFactory.getInstance(CucumberQuarkusTest.java:195)
	at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
	at io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:64)
	at io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
	at io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
	at io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10)
	at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:84)
	at io.cucumber.core.runner.TestStep.run(TestStep.java:56)
	at io.cucumber.core.runner.TestCase.run(TestCase.java:78)
	at io.cucumber.core.runner.Runner.runPickle(Runner.java:75)
	at io.quarkiverse.cucumber.CucumberQuarkusTest.lambda$getTests$6(CucumberQuarkusTest.java:141)
	at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:130)
	at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
	at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:130)
	at io.quarkiverse.cucumber.CucumberQuarkusTest.lambda$getTests$7(CucumberQuarkusTest.java:141)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$0(DynamicTestTestDescriptor.java:53)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptDynamicTest(QuarkusTestExtension.java:849)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:184)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:61)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:167)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:184)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:61)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:60)
	at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:32)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.execute(NodeTestTask.java:226)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.execute(NodeTestTask.java:204)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1242)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEachOrdered(ReferencePipeline.java:601)
	at org.junit.jupiter.engine.descriptor.DynamicContainerTestDescriptor.execute(DynamicContainerTestDescriptor.java:67)
	at org.junit.jupiter.engine.descriptor.DynamicContainerTestDescriptor.execute(DynamicContainerTestDescriptor.java:33)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.execute(NodeTestTask.java:226)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.execute(NodeTestTask.java:204)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.lambda$invokeTestMethod$1(TestFactoryTestDescriptor.java:108)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.invokeTestMethod(TestFactoryTestDescriptor.java:95)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at org.junit.platform.console.tasks.ConsoleTestExecutor.executeTests(ConsoleTestExecutor.java:66)
	at org.junit.platform.console.tasks.ConsoleTestExecutor.lambda$execute$0(ConsoleTestExecutor.java:58)
	at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33)
	at org.junit.platform.console.tasks.ConsoleTestExecutor.execute(ConsoleTestExecutor.java:58)
	at org.junit.platform.console.ConsoleLauncher.executeTests(ConsoleLauncher.java:95)
	at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:73)
	at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:50)
	at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:43)
	at org.junit.platform.console.ConsoleLauncher.main(ConsoleLauncher.java:37)
	at io.quarkiverse.cucumber.CucumberQuarkusTest.runMain(CucumberQuarkusTest.java:239)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.