Open qaEng1213 opened 5 years ago
The Backend classes would get called before the @Steps fields are injected (this is the way Cucumber works), but for setup code, I would generally recommend not using @Steps-instrumented classes, since this is setup code that you normally wouldn't want appearing in your test reports.
@wakaleo special thanks to you for the answer. If we leave aside test reports how could I implement this solution for setup code with @steps fields. I have a lot of complex logic in step libraries which I would like to reuse and "polluting" test reports is not such a big problem for now.
@wakaleo any solution for the question in my last comment here ?
I will need to look at the code and experiment. Does your company have a support contact for Serenity? That would allow more time to be spent on the question sooner.
No, we don't have a support contact. If there is no direct solution you can leave it for when you have more free time :) Thanks again.
Hey guys, I have the following issue:
I'm using serenity + cucumber on Java 8. I need a point in the test execution flow where I can execute code single time before tests' start (the so called "@BeforeTestRun hook"). The workaround I've found is this class as suggested here: https://github.com/cucumber/cucumber-jvm/issues/515#issuecomment-408560807
The bigger issue is that I want to use Serenity step libraries in
loadGlue
orbuildWorld
method but when I put a private property and annotate it like:and then try to invoke a method from the Step Library class, I get a
NullPointerException
.Please give any suggestions on how can I have the step libraries instantiated in the above class or where can I inject code which will run before tests execution and Serenity step library classes will be usable ?
Thank you in advance