quarkiverse / quarkus-cucumber

Quarkus Cucumber extension
Apache License 2.0
14 stars 14 forks source link

Only scenarios should be considered as Tests (starting/ending cucumber and beforeFeature methods should not) #123

Open AhmedDev98 opened 1 year ago

AhmedDev98 commented 1 year ago

Hello, As a new user of this quarkus extension, I expected to see only my scenarios as tests launched, but it seems that cucumber specific actions (starting/ending cucumber, before/after methods) are shown as separate tests also.

After reading code in CucumberQuarkusTest, this behavior is due to creation of DynamicTests for start/end of cucumber, and beforeFeature) : https://github.com/quarkiverse/quarkus-cucumber/blob/d288e48a6dc974e4457c60ca3de2afd337500341/runtime/src/main/java/io/quarkiverse/cucumber/CucumberQuarkusTest.java#L122 https://github.com/quarkiverse/quarkus-cucumber/blob/d288e48a6dc974e4457c60ca3de2afd337500341/runtime/src/main/java/io/quarkiverse/cucumber/CucumberQuarkusTest.java#L128 https://github.com/quarkiverse/quarkus-cucumber/blob/d288e48a6dc974e4457c60ca3de2afd337500341/runtime/src/main/java/io/quarkiverse/cucumber/CucumberQuarkusTest.java#L166

I may understand that's done in order to see each step separately, but this is causing the following issues when generating Junit surefire/failsafe reports:

  1. The number of tests shown is not correct
  2. Showing tests that are not really ones

In order to solve this issue, we my proceed as following:

  1. Create beforeAll and afterAll methods that will be responsible for starting/ending cucumber (in order to declare them as non static, we may need to add the following annotation: @TestInstance(TestInstance.Lifecycle.PER_CLASS)
  2. Include call to beforeFeature inside call of pickles (DynamicTests)

If you agree with this proposal, I can suggest a patch.

Thank you

vsevel commented 1 year ago

any news on this? cc @stuartwdouglas @christophd @tisoft