The testing of my app requires me to end each iteration of a testcase with opening the android’s “Settings” application, entering the bluetooth section and deleting a known connection to a device.
Here’s an example progression in my test:
#### Define applications to run
&{VPD_APPLICATION}=
... package=vPD.Android.VPD.Android
... activity=vpd.android.vpd.android.MainActivity
... alias=VPD_
&{SETTINGS_APPLICATION}=
... package=com.android.settings
... activity=com.android.settings.Settings
... alias=Settings_
#### Open my application (VPD)
${ID} = Open Application ${APPIUM_SERVER}
alias=${VPD_APPLICATION}[alias]
... appium:automationName=uiautomator2
... appium:platformName=Android
... appium:deviceName=${DEVICE_NAME}
... appium:autoGrantPermissions=true
... appium:appPackage=${VPD_APPLICATION}[package]
... appium:newCommandTimeout=600
... appium:appActivity=${VPD_APPLICATION}[activity]
... appium:noReset=${True}
#### Execute a batch script that flashes the device that we BT to
${PROG_RES} = Run Process ${BASH_PATH} ProgramVPD.sh
... --option ${VPD_SN} shell=True cwd=${BUILD_PATH}
#### Open Settings application and remove paired connection
${SETTINGS_AID} = Activate Application ${SETTINGS_APPLICATION}
[package]
# entering Bluetooth section and removing saved device ...
#### Restart VPD application and terminate Settings application
Open Application ${VPD_APPLICATION}[alias]
Sleep 2
Terminate Application ${SETTINGS_APPLICATION}[package]
Restarting my app after this progression often leads to it either crashing, or being “deactivate” to the background. How should this be done the correct way?