Cucumber-jvm @after with Appium driver

Hello ,

I’m using cucumber-jvm , and trying to implement global @after method which should be executed only once after all scenario’s execution was completed.
The @After method should quit the appium driver.

Currently @After hook being executed after each running scenario , and it means that the driver should be created each time from scratch , but I do want to reuse it.

Any help will be much appreciated

@igal_epshtein switch to testNG :slight_smile: -> https://github.com/cucumber/cucumber-jvm/tree/master/testng

it has tons of @After:

@BeforeSuite
@AfterSuite
@BeforeTest
@AfterTest
@BeforeGroups
@AfterGroups
@BeforeClass
@AfterClass
@BeforeMethod
@AfterMethod

-> https://testng.org/doc/documentation-main.html

how about singleton pattern?

How it will solve the teardown problem?
I want to have teardown only once after last scenario

no teardown then. But you will have to set up driver only once before run. Can you show what you already have?

no problem to set it once , simple singleton

the problem with tear down