-
Notifications
You must be signed in to change notification settings - Fork 15
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
Dependency is null when injected in Step definition classes #6
Comments
Do you have a simple reproducer I can look at? |
While i was creating a reproducer project, i found out the issue. please find attached project. 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. |
ok that makes sense to me because when running the test via Cucumber IntelliJ the So at the moment I do not see a simple solution for that |
Ah! This PR might solve this issue: #2 |
Is that PR all that is required? |
Following is needed:
|
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: And when executing the test restore it in the test thread: |
@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 ? |
I have a step definition and i need to inject a dependency of a repository , but the repository is null.
The same repository is injected without problems in other non-cucumber tests that are marked with @QuarkusTest
Test runner class is as follows:
Expected injected dependency inside the step class to be an instantiated object
Actual dependency is null
The text was updated successfully, but these errors were encountered: