The following are the top Appium blunders that folks make when creating mobile test automation frameworks.
Top 5 Appium Mobile Automation Mistakes To Avoid
1. Overusing XPath
Overusing XPath locators is a shared mistake with Selenium WebDriver, although it's a bit more egregious error in the Appium world.
XPath is a very powerful way to find elements, but it comes with a pretty big performance cost.
This is due to XML- and XPath-type queries, which are not natively provided by Google and Apple–at least in the way that we’d like them to be.
This forces Appium to make a lot of expensive calls under the hood to support finding elements reliably when using XPath.
So you can use XPath, but there are even better locator strategies you can use–like accessibility IDs.
2. Not Making Use of Accessibility IDs
Using accessibility ID locators for apps testing is preferred because it’s quicker.
In most cases, setting accessibility IDs on your elements to make them more testable helps make your mobile app more accessible—as long as you choose accessibility labels that are sensible to the human beings who are using them.
3. Not Making Your App Testable
Before one line of code is written for a new feature, the developers should be planning their solution with automation in mind. Developers should ask themselves, “How can I expose a hook or create a unique ID for this element in order to make it more testable?”
Only when an application is built with automation testing in mind right from the beginning will a team be truly successful with test automation
The main solution to most automation reliability issues is to have a conversation with your development team.
Asking them to put the right accessibility IDs, labels or unique IDs for your mobile app’s elements will solve many of your test automation issues.
4. Querying for the Visibility of Every Element
Querying for the visibility of every element that you retrieve will have a big impact on the runtime of your scripts.
When you do this, you're basically adding an extra overhead of calls and time waiting for Appium to do something every time you retrieve an element.
You want to be sure to only use lazily request element attributes, which are important in the context of your test code.
5. Not Using the Appium Docs
In Appium Documentation, we'll find what is essentially an API reference for Appium,
every command that it supports–which client libraries, which drivers it supports–are now all documented.
They’ve even worked on adding a bunch of code examples.