serenity-bdd / serenity-cucumber

Cucumber integration for the Serenity BDD Reporting library
Other
78 stars 74 forks source link

Sharing steps/step defintions between mulitple projects #162

Open mohanrajmcad opened 6 years ago

mohanrajmcad commented 6 years ago

I am in the process of implementing serenity-cucumber to test microservices. We have around 50 microserivces in the environment that has been consumed by different channels like web and mobile. As per current approach I am using one single repososiotry and placing one features file per micro service, So that particular micro service can be tested independelty. And also this "single repository" can be used to create E2E scenarios as well.

However each microservices are getting deployed indepedenly in delivery pipeline, team is asking me to create 1 serenity reposiotry project for 1 service to test that particular service in the pipeline. So Is that possible to have 50 different sernity-cucumber repository and if I want to create e2e integration tests for 10 microservices then i can create new serenity repository and import content(steps/step definitions) from any particular microservice repository.

If I enable 50 microservices available as shared component repo, and any one can import and use only required repo for their project.I am not sure if this is possible at the moment with serenity BDD, please share your thoughts.

wakaleo commented 6 years ago

This is related to Cucumber rather than Serenity BDD. You would just need the step definitions for a microservice to be in a separate project or module (but in the same repo as the micro service).

kxramas commented 4 years ago

Hello, Does importing cucumber step definitions from external / separate project really work ? I have tried adding external project that contains step definitions (i.e., G/W/T implementations) to the classpath and providing @CucumberOptions glue pointing to that external package but no luck!

Appreciate if you can guide how to achieve this please.

Many Thanks!

wakaleo commented 4 years ago

If the annotated classes are on the class path and referenced by the "glue" tag in the @CucumberOptions annotation, they should work.

kxramas commented 4 years ago

I have tried 1) glue = "classpath:com.des.e2e.cucumber.stepDefs" 2) glue = "com.des.e2e.cucumber.stepDefs" 3) glue ="..com.des.e2e.cucumber.stepDefs" and few other combinations ... I am sure annotated classes are on the classpath as I can import the package manually and instantiate the class. Also tried with cucumber 2 and 4. Can't think of what's missing.

Thank you!

wakaleo commented 4 years ago

This is not really a Serenity-related question, as it involves the Cucumber internals. Have you asked the Cucumber community?

On Wed, 28 Aug 2019 at 12:42, kxramas notifications@github.com wrote:

I have tried

  1. glue = "classpath:com.des.e2e.cucumber.stepDefs"
  2. glue = "com.des.e2e.cucumber.stepDefs"
  3. glue ="..com.des.e2e.cucumber.stepDefs" and few other combinations ... I am sure annotated classes are on the classpath as I can import the package manually and instantiate the class. Also tried with cucumber 2 and 4. Can't think of what's missing.

Thank you!

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/serenity-bdd/serenity-cucumber/issues/162?email_source=notifications&email_token=AAANVMX5CV2ZJAFCR4FZHRDQGZQBNA5CNFSM4FKO6RCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5K2NTA#issuecomment-525706956, or mute the thread https://github.com/notifications/unsubscribe-auth/AAANVMWOFBJWGAQKM4SCZMDQGZQBNANCNFSM4FKO6RCA .

--


John Smart | Wakaleo Consulting | +44 7398 832273 Making smart teams collaborate better http://johnfergusonsmart.com | john.smart@wakaleo.com


We love breaking down silos and helping smart teams collaborate better! Ask about our tailored on-site workshops https://johnfergusonsmart.com/training/ in Agile Product Planning http://johnfergusonsmart.com/programs-courses/next-generation-agile-delivery-product-planning/, BDD Requirements Discovery http://johnfergusonsmart.com/programs-courses/mastering-agile-requirements-behaviour-driven-development/, BDD, TDD and Clean Coding http://johnfergusonsmart.com/programs-courses/bdd-tdd-clean-coding/, and Advanced BDD Test Automation http://johnfergusonsmart.com/programs-courses/advanced-bdd-test-automation/ .

Need some help with Serenity BDD? Check out our Serenity BDD training and support packages here https://johnfergusonsmart.com/serenity-bdd/.


kxramas commented 4 years ago

Not asked yet but looked up several places with no working solution. I also understand its not serenity related but the chat here seemed precise to what I need. Hence, trying it here.

kxramas commented 4 years ago

This is solved! Just to benefit others - if cucumber annotated classes in external project are under src/test/java follow https://maven.apache.org/plugins/maven-jar-plugin/examples/create-test-jar.html