Giter Site home page Giter Site logo

Comments (8)

stuartwdouglas avatar stuartwdouglas commented on June 21, 2024

Do you have a simple reproducer I can look at?

from quarkus-cucumber.

ahmedabbas11 avatar ahmedabbas11 commented on June 21, 2024

While i was creating a reproducer project, i found out the issue.
The issue occurs when I run a single scenario through intellj plugin; Intellj creates a cucumber run configuration. but then dependencies inside steps are null.
But when i run from the Runner class extending CucumberQuarkusTest, tests pass without issue and dependency injection works without problem. Intellj creates a gradle run configuration at this case.

please find attached project.
https://github.com/ahmedabbas11/quarkus-cucumber-dependency

While i can runs tests from gradle now, but running all the tests each time is not practical at the long run , whe steps grow in size and it would take time to run them all, then it is necessary to be able to run single scenario.

from quarkus-cucumber.

christophd avatar christophd commented on June 21, 2024

ok that makes sense to me because when running the test via Cucumber IntelliJ the @QuarkusTest annotation is not taken into account. This is simply because Cucumber is running the test and not Quarkus (via JUnit5). Not sure if the test is even run with JUnit5 when running via IntelliJ Cucumber plugin. When running the test with CucumberQuarkusTest the @QuarkusTest annotation prepares everything including @Inject support.

So at the moment I do not see a simple solution for that

from quarkus-cucumber.

christophd avatar christophd commented on June 21, 2024

Ah! This PR might solve this issue: #2

from quarkus-cucumber.

stuartwdouglas avatar stuartwdouglas commented on June 21, 2024

Is that PR all that is required?

from quarkus-cucumber.

tisoft avatar tisoft commented on June 21, 2024

Following is needed:

  1. The PR #2
  2. Adding a main method to the test class:
public static void main(String[] args) {
    runMain(CucumberOptionsTest.class, args);
}
  1. Changing the Main class in the IntelliJ Run Configuration

from quarkus-cucumber.

smeulend avatar smeulend commented on June 21, 2024

The solution for this is restoring the original class loader within the test.

So once the context has been created, obtain the classloader and store it:
var originalClassLoader = Thread.currentThread().getContextClassLoader();

And when executing the test restore it in the test thread:
context.runTestCase(r -> {
if (originalClassLoader != null) {
Thread.currentThread().setContextClassLoader(originalClassLoader);
}
r.runPickle(p);
});

from quarkus-cucumber.

khush2704 avatar khush2704 commented on June 21, 2024

@ahmedabbas11 , I want to know how you are running your cucumber tests, is it integrated with your quarkus application or you have dedicated cucumber project, using its dependency in your qaurkus application and invoking cucumber tests ?

from quarkus-cucumber.

Related Issues (20)

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.