javaninja
2 years agoOccasional Visitor
Java - execution order between Junit tags and Cucumber hook tags - which ones go first?
Hello, is there any conjunction between Junit tags and Cucumber hook tags execution order ? I have a project with Cucumber feature file, step definition file and page object model. In feature file I want use tag @pageOne and @pageTwo
then in Cucumber hook class I have:
public static List<String> list; @Before(@pageOne) public void beforeOne (Scenario scenario) { list = scenario.getSourceTagsNames().stream().collect(Collectors.toList()); } @Before(@pageTwo) public void beforeOne (Scenario scenario) { list = scenario.getSourceTagsNames().stream().collect(Collectors.toList()); }
Then in other class I have @Before Junit annotation.
@Before public void setUpProperties() { Properties properties = new Properties(); properties.load(new FileInputStream(appConfigPath)); if (list.contains(@pageOne)) { String url = properties.getProperty("pageOne"); } if (list.contains(@pageTwo)) { String url = properties.getProperty("pageTwo"); }
So I have to run @Before cucumber tag earlier than Junit @before tag because I have to pass ivalue from cucumber before method to junit before method.
Is this possible to set annotation tags order ? I want to run cuumber tag earlier than junit tag.
Thank you