mardi 29 décembre 2020

Using multiple Cucumber Runners on the same project under different packages is a good practice?

I want to use Cucumber for testing all the API's as TestNG tests, inside my microservice which is a SpringBootApplication.

So I've defined for the beginning 2 feature files under: src/test/resources/features:

  • API1.feature
  • API2.feature

Then, for each feature file, I have implemented the Step Definitions classes and CucumberRunners under src/test/cucumber:

/API1:

  • StepDefAPI1.java annotated with @CucumberContextConfiguration
  • CucumberRunner.java - extends AbstractTestNGCucumberTests

/API2:

  • StepDefAPI2.java annotated with @CucumberContextConfiguration
  • CucumberRunner.java - extends AbstractTestNGCucumberTests

Is this a good practice to apply, having one CucumberRunner for each feature file?

Because otherwise, letting just one CucumberRunner.java class with one Configuration class (annotated with @CucumberContextConfiguration) will lead to unexpected behavior when the tests are being ran on Jenkins (they are failing due to some MongoDB exceptions [https://ift.tt/38KiWMB] while locally is all smooth).

Aucun commentaire:

Enregistrer un commentaire