React Native + Appium

Shruti Pandey
2 min readDec 1, 2021

What is React native

What React Native says: https://reactnative.dev/

React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces.

Why exactly was there a need for it?

React native helps with hybrid app development

Meaning, a native should look, feel and do the same job despite it working on a Android or IOS device

React native made that difficult task possible

What is appium?

To write a code that interacts with another code,

the former not only needs to interact with the latter but also, inspect, identify, understand the elements on a given UI

Appium help us with that

You can also, call it the client-server architecture

The appium client sends a request to the server,
The server sends a request to the device to perform the necessary action.
The server would then return the result back to client to update the test status

How can I combine React Native with appium to make testing possible

So given the fact, React Native makes development of both Android and IOS apps possible

It is not as easy or straightforward to test it

To add to the complexity, some features or components of React Native are native
while others use webview
and appium detects and understands these behaviour :D

Back in my testing and automation days, when I struggled with a good reliable and sustainable xpath for an element,

I would ask my fellow developers, why can’t they name — elements and objects judiciously

This is exactly the biggest pro-tip in case of React native app development and automation

Due to the nature and behaviour of React native apps on Android and IOS and the difference between the device types and OS,

It is a best practise that both testID and AccessibilityLabel added as an attribute for every component to be tested

So, when in case, testID may not be a characteristic of a component on a particular device type,
there is still another better attribute to help capture and test the element on

I hope these quick tips and tricks help you in your React Native automation with Appium

--

--