---
title: React Native Appium Testing | TestingBot Blog
description: React Native makes it easy to create mobile applications for both iOS
  and Android.
source_url:
  html: https://testingbot.com/blog/react-native-testing
  md: https://testingbot.com/blog/react-native-testing.md
---

# React Native testing

By [Jochen D.](https://testingbot.com/about/jochen-d)2019-10-03

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

 ![react native testing](https://testingbot.com/assets/blog/2019/reactnative.png)  
React Native makes it easy to create mobile applications for both iOS and Android.

Developers create the mobile app with Javascript and then have React Native compile these into native mobile apps. The mobile apps that React Native creates look and behave exactly as apps created with Java/Kotlin or Objective-C/Swift.

The project was created by Facebook and is still maintained by Facebook, it regularly receives updates and fixes. The main advantages of using React Native:

- It makes developing apps much faster: you don't have to recompile after every change, and your code will work on both iOS and Android. No need to write code twice.
- You can still run native code inside React Native. If you have existing code, or third-party code you want to use, you can use it with React Native.
- There's a big eco-system of developers and other engineers who can help and answer your questions. Because it's so popular, it's a very stable project with regular bugfixes.

In this article, we'll go through the steps necessary to create an application, modify it for automated testing and then test it automatically via Appium on TestingBot.

## Creating a React Native Application

To [get started](https://reactnative.dev/docs/getting-started), please install React Native:

`npm install -g react-native-cli`  

Once you have installed React Native, it is time to create our project:  
`react-native init TestingBotDemo`  
`cd ios && pod install`

This will create a skeleton of files and set everything up for you to test/create your mobile application.

To get started, let's create our main component. We'll create a basic calculator that will require two numbers and show you the sum of those numbers.

```
import React, { Component } from 'react'
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  Text,
  TextInput,
} from 'react-native'

class App extends Component {

  constructor(props) {
    super(props)
    this.state = {
      inputA: 0,
      inputB: 0,
      sum: 0
    }
    this.onInputAChange = this.onInputAChange.bind(this)
    this.onInputBChange = this.onInputBChange.bind(this)
  }

  onInputAChange(inputA) {
    this.setState({ inputA }, () => {
      this.updateSum()
    })
  }

  updateSum() {
    const { inputA, inputB } = this.state
    const sum = parseInt(inputA, 10) + parseInt(inputB, 10)
    this.setState({ sum })
  }

  onInputBChange(inputB) {
    this.setState({ inputB }, () => {
      this.updateSum()
    })
  }

  render() {
    const { sum, inputA, inputB } = this.state

    return (
      <SafeAreaView>
        <View style={styles.container}>
          <Text>InputA</Text>
          <TextInput
            editable
            maxLength={5}
            value={inputA.toString()}
            onChangeText={this.onInputAChange}
            testID= {"inputA"}
            accessibilityLabel= {"inputA"}
          />
          <Text>InputB</Text>
          <TextInput
            editable
            maxLength={5}
            value={inputB.toString()}
            onChangeText={this.onInputBChange}
            testID= {"inputB"}
            accessibilityLabel= {"inputB"}
          />
          <Text>Sum</Text>
          <TextInput
            editable={false}
            value={sum.toString()}
          />
        </View>
      </SafeAreaView>
    )
  }
};

const styles = StyleSheet.create({
  container: {
    justifyContent: 'center',
    alignItems: 'center',
    display: 'flex',
    marginTop: 32,
    paddingHorizontal: 24,
  }
});

export default App;
```

This example App creates a view with 2 input fields (`InputA` and `InputB`). Once the user puts in some numbers, the state will update and the sum will be shown in `Sum`.

## Preparing your React Native App for UI Testing

The important part we want to focus on here are the `testID` and `accessibilityLabel` attributes. These are the attributes that allows your Automated Test to quickly locate the input fields.

For iOS tests with XCUITest, the `testID` makes it much easier to locate an element in your tests. You can use the value specified in this attribute as a locator for your Appium tests. This works much better than using `XPath` for locating elements, because an XPath expression can become complicated very fast, and is prone to change.

Android testing via Espresso or UIAutomator does not use this `testID` attribute. Instead, you can use the `accessibilityLabel` in your tests for Android tests.

## Testing your React Native app with Appium

Now that we have prepared our app for testing, we can run a test that will add some simple numbers and verify if the calculator works:

```
from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

desired_caps = {
    "deviceName": "Galaxy S8",
    "platformName": "Android",
    "version" : "9.0",
    "app": "https://testingbot.com/appium/sample.apk",
    "realDevice": true
}

driver = webdriver.Remote("http://key:secret@hub.testingbot.com/wd/hub", desired_caps)

inputA = WebDriverWait(driver, 30).until(
    EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "inputA"))
)
inputA.send_keys("10")

inputB = WebDriverWait(driver, 30).until(
    EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "inputB"))
)
inputB.send_keys("5")

sum = WebDriverWait(driver, 30).until(
    EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "sum"))
)

if sum!=None and sum.text=="15":
  assert True
else:
  assert False

driver.quit()
```

This will launch the app on a physical Android device in the TestingBot datacenter. The test will locate both inputs, put in a number, and then verify if `sum` is correct.

We have a lot of more documentation on [mobile app testing](https://testingbot.com/support/app-automate/appium) in our documentation section.

## Conclusion

React Native provides an easy framework to quickly write mobile apps for both iOS and Android. It has very good test frameworks, such as Jest, to create functional and unit tests with snapshots.

It is important to write end-to-end tests, testing the UI and functionality of your app on real devices, before your release it on the App Store. With Appium testing, automated tests will mimic the action of your end users; tapping, swiping, etc.

TestingBot provides mobile devices (real devices and emulators) to run your tests on a variety of configurations (different OS versions and device specs).

If you'd like to get started with mobile app testing, please sign up for a free account and try our easy to follow tutorial on [mobile app testing with Appium](https://testingbot.com/support/app-automate/appium).

[← Previous post macOS Catalina Automated Selenium Testing](https://testingbot.com/blog/macos-catalina-testing) [Next post → Mobile Locators for Automated Testing](https://testingbot.com/blog/mobile-locators-for-appium)

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights)

#### Announcing AI Test Insights

Use AI Insights to quickly discover why an automated test...

[Read: Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright)

#### Selenium vs Playwright 2026

Comparing Selenium vs Playwright - which is the best test...

[Read: Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing)

#### Maestro Physical Device Testing

Maestro testing in parallel on physical Android and iOS d...

[Read: Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

## Related Articles

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright "Selenium vs Playwright 2026")

### [Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

Comparing Selenium vs Playwright - which is the best test framework for your usecase?

[Read article →](https://testingbot.com/blog/selenium-vs-playwright)

[![Playwright Testing on TestingBot](https://testingbot.com/assets/blog/2023/playwright-testing.jpg)](https://testingbot.com/blog/playwright-testing-introduction "Playwright Testing on TestingBot")

### [Playwright Testing on TestingBot](https://testingbot.com/blog/playwright-testing-introduction)

Learn how Playwright can run your automated tests on a variety of browsers, local or remote browsers on TestingBot.

[Read article →](https://testingbot.com/blog/playwright-testing-introduction)

[![tvOS Physical Device Testing](https://testingbot.com/assets/blog/2025/appletv.jpg)](https://testingbot.com/blog/tvos-automated-testing "tvOS Physical Device Testing")

### [tvOS Physical Device Testing](https://testingbot.com/blog/tvos-automated-testing)

Run automated tvOS tests on physical AppleTV devices.

[Read article →](https://testingbot.com/blog/tvos-automated-testing)

[![Selenium 20th birthday](https://testingbot.com/assets/blog/2024/selenium20.webp)](https://testingbot.com/blog/selenium-20-years "Selenium 20th birthday")

### [Selenium 20th birthday](https://testingbot.com/blog/selenium-20-years)

Celebrate Selenium's 20th birthday. An overview of the years.

[Read article →](https://testingbot.com/blog/selenium-20-years)

## More by Jochen D.

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")
### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing "Maestro Physical Device Testing")
### [Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

Maestro testing in parallel on physical Android and iOS devices.

[![tvOS Physical Device Testing](https://testingbot.com/assets/blog/2025/appletv.jpg)](https://testingbot.com/blog/tvos-automated-testing "tvOS Physical Device Testing")
### [tvOS Physical Device Testing](https://testingbot.com/blog/tvos-automated-testing)

Run automated tvOS tests on physical AppleTV devices.

[See all posts by Jochen D. →](https://testingbot.com/about/jochen-d)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
