-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
Unable to access @Autowired classes inside @Steps class #3586
Comments
@wakaleo could you please look into it? |
This is most likely a configuration issue in your test setup. I work on many client projects using Spring and SpringBoot with Serenity, but the annotations can be tricky to get right so that they are picked up correctly. I would be happy to take a look as part of a commercial support package. |
Hi @wakaleo, is there any sample project i could refer? |
Have a look at https://github.com/serenity-dojo/wordle |
Thank you @wakaleo .. I will look into it. |
What happened?
@autowire not initiating the class inside @steps class with Junit 5 - @IncludeEngines("cucumber")
What did you expect to happen?
@autowire class should be accessible inside @steps classes
Serenity BDD version
4.0.28
JDK version
17
Execution environment
OS: Windows
Browser : Chrome
Framework :
Spring boot - 3.4.0
Junit 5
Cucumber - 7.15.0
How to reproduce the bug.
Runner class
@suite
@IncludeEngines("cucumber")
@SelectClasspathResource("/features")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.automation.springboot.cucumber.steps")
public class TestRunner {
}
Init class
@SpringBootTest(classes = CucumberTestApp.class)
public class Init extends PageObject {
}
Run config
@DaTa
@component
@propertysource("classpath:config/newprop.properties")
public class RunConfig {
}
Step Def
@component
public class DemoStepDef extends Init{
}
Google page
@component
public class GooglePage extends PageObject {
}
RunConfig works find in Step definition class but returns null in GooglePage class. How to inject Spring boot context inside @steps classes?
How can we make it happen?
Add it to the Serenity BDD backlog and wait for a volunteer to pick it up
The text was updated successfully, but these errors were encountered: