I have a cucumber scenario with different tags @all @crm @ui @agreementLogic @agreementLogicLazadaActive
And also I have two hooks with differenet values
@After(value = "@ui", order = 1)
public void tearDown(Scenario scenario) {
if (scenario.isFailed()) {
AllureReporter.addScreenShot();
}
Browser.stop();
}
and
@After(value = "@all",order = 2)
public void afterAll() {
removeScenarioEnvironment();
AllureReporter.attachScenarioLogFromLogFile();
}
I need that hook for tag @ui been executed before hook for tag @all, as you can see I set them order, but it doesn't work.
@Before(order = int)
: This runs in increment order, means value 0
would run first and 1
would be after 0
.
@After(order = int)
: This runs in decrement order, means value 1
would run first and 0
would be after 1
.
Yours:
@After(value = "@ui", order = 1)
@After(value = "@all",order = 2)
Updated:
@After(value = "@ui", order = 2)
@After(value = "@all",order = 1)