Saimohit Midde
Saimohit Midde

Reputation: 13

how to prioritize serenity bdd (cucumber)test execution with tags

I have test cases bank account creation. There two scenarios one is application submission with tag @logApplication and second one the involved application process which involves will take sometime process it, it tab name @processAppliction. How to execute test case with tag @logApplication first then @processAppliction test cases. How can achieve this on cucumber.

ex: There are 10 scenarios with @logAoolication. I want to execute all these 10 test cases first before @processAppliction test cases. I am using junit5 runner with serenity bdd framework. Please suggest.

I know how given priority for hooks but I didn't find any thing priority based on test tag.

Upvotes: 0

Views: 253

Answers (1)

SjB
SjB

Reputation: 1

Researching a similar issue yesterday, I will share an alternate approach that I am considering for similar use cases.

Background: may be your cucumber answer.

https://johnfergusonsmart.com/how-can-i-reuse-my-gherkin-scenarios/

Background:
  Given Actor sets up API connection
  And Actor has processed 10 Applications

Scenario: Process Application
  Then he should see his application in the new application list

This isn't an order of tags answer. All my reading suggests tags should not trigger order because tests should be encapsulated. In my opinion, your desire to 'setup the data first before processing' could be accomplished in this approach.

The article will note that it runs on each scenario, so you may have to add logic flag to indicate "already run once" and skip it on subsequent Background calls which exist before each scenario.

Upvotes: 0

Related Questions