Testing React-Native Apps with Appium - The Ultimate Guide
You can now test your native apps on Appium. The platform is flexible and can be used to test both iOS and Android applications. Our developer tested it out and here’s a simple way in which you can test your apps too.
Subscribe to our awesome Newsletter.
Facebook’s Snapshot is great for ReactJS but for testing ReactNative applications it isn’t too effective as ReactNative renders native UI components. Appium is built on testing native apps and native components and is more effective than snapshot jest test. With Appium can be used to test both iOS and Android applications.
For iOS: It requires Mac OSX and with latest Xcode & command line tools
For Android: It requires Mac OSX or Windows or Linux OS with Android SDK >= 16
Getting started with Appium
For get started on testing with Appium it requires Appium in your machine with Appium standalone server and Appium java client.
- You can install Appium by visiting http://appium.io
- As we write test cases on java we require Java IDE. Most recommnded for Appium testing is IntelliJ IDEA https://www.jetbrains.com/idea/download or if your are not conforatbale, you can stick to your usual Java IDE
- Appium testing requires Java-client. You can download it from https://github.com/appium/java-client
- It requires Selenium Standalone Server
Before you start running test for iOS applications, you need to Enable UI automation in your Developer settings (only for iOS)
You can now run test for your application.
Run Appium application to get started with testing and you can launch Appium server and inspect with this. You can start testing by selecting the targeted platform. You can config targeted platform by clicking on icon on targeted platform. It requires App path, bundle ID, UDID and targeted device for configuring targeted platform.
You can start testing by clicking launch button on Appium application. You can inspect individual UI components and whole UI container with Appium Inspector. Clicking on UI components on inspector you get details of component where you use this information for interaction while testing the app.
Start creating simple Java application with your IDE. You can grab the dependencies which are manually downloaded before. Make sure you import all dependencies before you run testing and add following code snippets for setting up app launch through Appium,
Before action is used to start Appium connection with server and after action is used to quit Appuim connection. APPIUM_SERVER_URL is the Appium server end point.
Simple test action
You can test button’s click action creating a test method. Make sure you add test annotation before the method. First you need to find element. You need to find element by strategy like ID, path, name etc which is provided in the information Appium inspector window.
You should run test after closing Appium inspector and restarting the server. You can now perform click action and result will be shown in the console 🙂
Try it out and tell us how it goes!