Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to retrieve cucumber tags?

Tags:

java

cucumber

I am looking for some thing like that:

@tag1
Feature : My new feature ....
@tag2
Scenario ...

And now I want to get hold of these tags to create a generic setup.

@Before
public void setup() {
    String annotation = readAnnotation(...);

Is there any way to get hold of the annotation or annotations I have added to the features and/or scenarios my code is currently prcessing?

like image 675
Jefe infiltrado Avatar asked Aug 24 '16 08:08

Jefe infiltrado


1 Answers

Pass the scenario object into the @before method. Then use getSourceTagNames() method of the scenario object.

like image 137
Grasshopper Avatar answered Sep 21 '22 18:09

Grasshopper