Suite fails in middle of execution

Scenario is in test suite I use Mobile.startApp at start of suite and use Mobile.closeApp at end of suite
so in middle of execution the suite fails and causes half of the total cases fail i.e out of 80 test cases - 30/40 cases fails due to that
Getting this error

Unable to start app at “path_of_apk”(java.io.IOException: GetExitCodeProcess error=6, The handle is invalid at com.kms.katalon.core.appium.driver.AppiumDriverManager.isAppiumServerStarted(AppiumDriverManager.java:194)

I have read that if I don’t use Mobile.closeApp then it will stack node js process and eventually cause Appium server to hung up I don’t exactly know about it so is there any way to avoid above error without closing application… like programmatically kill all node process and start it again or something like that

I don’t want to use closeApp in middle of execution so can someone provide alternative method for it

@kazurayam @duyluong @Chris_Trevarthen @Russ_Thomas

Thanks,

Sorry, I don’t do anything with Mobile.

I don’t think so.

Once your test started the app, your test is responsible for closing the app before your test finishes regardless it succeeded or failed in the middle of test steps. You’ve got to tidy up things before you leave.

I am not sure if this is what you are looking for but for all of my tests I run this try catch to use the running appium driver if one exists and the start the existing application if not. At the end of my test I just restart the app instead of calling closeApp. This keeps execution time low since startApplication usually takes a while to run and it usually only needs to run once per test suite.

AppiumDriver<?> driver

//setup
try {
	driver = MobileDriverFactory.getDriver()
} catch (Exception startApp) {
	Mobile.startExistingApplication(appID)
	driver = MobileDriverFactory.getDriver()
}

//test

//restart app
driver.resetApp()

Yes but my requirement is like once I start application then perform different scenarios without closing application
for eg: On screen there are 2 buttons after clicking validate some element/data then go back
in test suite
1st case start application
2st test case click button 1 then check if element is present if not go back and mark it as fail
3nd case continues from here click button 2 then perform same operation and so on…
end case close application

so in above scenario I don’t want to close app in middle of suite rather I want to close application at end of suite

But after doing this I think above error GetExitCodeProcess error=6 is generating

Hi I explained the scenario in that can you please check what I actually needed if you have any solution for that please let me know