I am trying to implement an automated evidence capture system for each cucumber scenario that is executed. As part of that I need to use the first scenario @tag as part of the evidence folder name.
However, I have found that the getSourceTagNames() method on a cucumber scenario returns the list in a random order, compared to the order in which the tags were written. So simply calling scenario.getSourceTagNames().get(0) will not consistently give me the tag I need.
e.g Scenario: Example @tagINeed @secondTag @thirdTag
getSourceTagNames() may return {@thirdTag, @tagINeed, @secondTag}
Is there a way to ensure the list returned is in the same order as the order in which it was written?