Feature Friday – Boost Your Mobile Testing with Xpath Locator Strategy
The holiday rush is officially over! With this holiday season now in the rearview mirror, it’s time to look forward to the road ahead and get prepared for an undoubtedly busy 2023. But don’t worry, Qyrus isn’t throwing on the breaks anytime soon when it comes to features! This week, we are joined by Daniel and Joyal from our Chicago Qyrus team to learn more about some new mobile native locator strategies that have been introduced to the Qyrus platform. Without further delay, let’s race into this topic!
Tell us more about this capability offered by Qyrus and its use cases.
Qyrus mobile testing now has support for 3 native locator strategies when users are building out their test scripts. There are two that are supported for iOS – class chain and predicate string – and one for Android – UIAutomator.
This is helpful for those mobile testers that are more experienced. Native locators can speed up test executions by improving the performance of locating the element. There are elements out there that cannot be found by using ID, name, accessibilityID, or XPath locator types.
Even though this strategy is the most common out there and platform agnostic; that is to say, it works for both iOS and Android devices, but can be the most time-intensive choice. By choosing a native locator strategy, a tester can leverage the flexibility that an XPath can provide but without incurring a performance penalty.
For the reader’s benefit, we have provided an example below:
Example of XPath on iOS:
As a class chain, this XPath can look like this:
**/XCUIElementTypeOther[label matches “login”]
But using a predicate string, it could look like this:
label matches “login”
What is the overall impact this might have on the testing process?
We can see this having an impact during the test building phase when users are creating and building up their catalogue or suite of test scripts for execution. This can help expedite the test building process, since to an experienced mobile tester, using something like predicate string is much quicker than having to get an XPath for every element.
Not only that, but since we see faster run times, we can say there’s a definite impact to test executions. The new native locator strategies provide an overall speed boost to the testing process as a whole.
Qyrus is always looking to push the limit when it comes to developing new tools and strategies to help enable better testing across the board for everyone involved. This is not limited to different levels or types of testers, but also less technical personnel.
How might these new native locator strategies help testers, developers, and business technologists? What value can this feature bring?
Well, as we mentioned before, an advanced tester might find the most use out of this feature. In general, it makes their testing experience easier. But besides that, using predicate string also makes it easier for less technical users of Qyrus to understand what is being searched for. Seeing “label matches ‘login’” is much easier to understand what the test is looking for than a long, exhaustive XPath.
And for developers, they’d find use in this much similar to a tester. It would make their unit testing and quick tests much easier to create, run, and maintain in the long run.
Does the same or similar functionality exist without Qyrus, and how do competitors address similar problems?
There are a few competitors out there that do offer all these strategies already, but on Qyrus we are striving to make these strategies more usable for both experienced and newer testers.
And when it comes to using these strategies outside of Qyrus, anyone can really do it when they’re scripting their own automated tests. It’s just that everything has to be done through code whereas on the Qyrus platform everything is no-code and simple to use.
Our features on Qyrus have the one goal of making testing more efficient, but that can be done in several ways. Speeding up the time it takes to build and execute tests, providing more insight in reporting, and enabling more intuitive test building are just some ways we are actively working to make testing more efficient.
How do you see these impacting day-to-day operations across organizations?
Speed is really the main benefit of using these strategies. But there are some other advantages that can help to even further speed up day-to-day operations. “UIScrollable” can be used to automatically scroll the element if it is not in view, for example. This functionality is built into the locator strategy and is not possible with other strategies.
And to further the topic of speed, the time taken to find elements during iOS testing is significantly reduced. For example, what might take an XPath strategy 2.8 seconds to find an element can be done in 1.8 seconds with predicate string and even quicker at 0.7 seconds using class chain.
That wraps up this week’s Feature Friday. The drive for new and innovative testing strategies is greater than ever and slowing down now could mean getting into a wreck in the future, so help protect yourself by switching to Qyrus as your testing platform! We hope that this weekend, you take some time to slow down, stop, and enjoy some time off from your busy, racing weekly schedule. And then on Monday, maybe sign up for a Free Trial and check us out! Thanks again!