Best Practices

Last modified on July 21, 2021

There are some best practices to use when writing Appium tests. The test cases of a test suite should reuse the same webdriver between the tests and not recreate a new session every time.

In BitBar Testing, after each test case (a closed Appium session) the device under test is put offline for automatic cleanup. This will cause the following tests of the test suite to fail.

Instead, a test suite should reuse the first webdriver session from the first test case in all the test cases or add a proper wait time between each test case, send a request to our API and wait for the device to become available again. The app can be closed and restarted without having to close the Appium webdriver session:

# close current app
driver.closeApp()
# re-launch the app
driver.launchApp()
# resets the app ~ re-install
driver.resetApp()

See Also

Appium Support
Troubleshooting

Highlight search results