Mobile Testing

Native Mobile App Testing: A Step by Step Guide

Reading Time : 24 min read
native-mobile-app-testing

Native mobile app testing starts with a user journey and a result you can check on a device. Follow the six steps below. If the journey opens a web form or browser, test what happens when control returns to the app.

This guide is about testing. If you are still choosing what kind of app to build, start with our comparison of web apps vs native apps vs hybrid apps. For definitions of native, hybrid and cross-platform apps, see the difference between native and non-native mobile apps.

The six steps of native mobile app testing

The six steps run in order. Each one ends with something you can check. By step 6 you have a journey that runs by hand and in automation, on the devices your users have, with a pass condition anyone on the team can read. They sit inside the wider mobile app testing process, and the types of mobile app testing guide covers which kinds of testing a release needs.

1. Pick the framework for each platform

Before you pick a tool, name the journey, its starting state and the result that counts as a pass. “Sign in, save a draft, reopen the app, see the draft” is a journey. “Test the login screen” is not.

Then pick the framework that can reach every screen in that journey:

Platform and UIFrameworkReaches
iOS, native UIXCUITestYour app’s UI, from Xcode
Android, ViewsEspressoYour app’s View-based UI
Android, Jetpack ComposeCompose UI testsUI elements exposed in the Compose semantics tree
Android, system UI or another appUI AutomatorPermission dialogs, notifications, settings, other apps
Both platformsAppiumBoth platforms, with shared journeys and per-platform locators

Appium, an open-source framework that drives both platforms through the WebDriver protocol, lets you share the journey and its assertions across iOS and Android. It does not let you share everything. You still configure the driver, the locators and permission handling for each platform.

Who writes the tests breaks a tie. Developers working in the app repo tend to prefer XCUITest and Espresso, because the tests live next to the code. A QA team covering both platforms tends to prefer Appium. Testers who do not write code can start with scriptless test automation. For platform depth, see our iOS app testing guide and Android app testing guide.

Check: Write down the starting account, the saved draft you expect to see and the tool that can reach each screen.

2. Make a build you can test

Upload an APK or AAB for Android, or a signed device IPA for iOS. Seed a test account so every run starts from the same state. Keep the accounts separate per platform and per parallel run, and script the setup, so anyone can rebuild a known state without hunting for an account in the right condition.

On iOS, check the signing before you test anything that depends on an entitlement. Push notifications, universal links and Apple Pay all need a build signed for the device pool with those entitlements intact. If your device lab re-signs apps and the re-signing would strip them, keep your original signing identity.

If your Appium test needs the DOM inside a WebView your app owns, enable inspection for that WebView in the test build. Follow the Android or iOS inspection steps below.

Debug builds and release builds can behave differently. Run your main journeys on a release-equivalent build before you sign off.

Check: Install the candidate on a target device and confirm the test account starts in the expected state.

3. Choose the devices

Pick devices from actual usage, your supported OS range and a lower-memory hardware tier. Your own analytics decide the list, not market-share averages. A workable starting set is the current OS version, the previous one and your declared minimum, on the models your users run most, plus one older, lower-memory device.

Sizing the full matrix is its own job. Our compatibility testing guide covers it.

Check: Use the lower-memory device to check for problems under memory pressure. Record the models and OS versions you will run.

4. Run one journey by hand

Start in a known state on each supported platform. Take the action. Check the result a user would see.

Use one iOS device and one Android device from your list. Emulators and simulators are fine for a fast first pass while you build. They are not where you sign off a release.

While you walk the journey, watch for what scripts miss. Does the keyboard cover the field you are typing in? Does the layout hold at a larger system font size and in dark mode? Do the platform gestures behave, such as the Android back gesture and the iOS swipe from the edge? Does a long name or address wrap or get cut off on the smallest screen in your list? Each of these is a check you can write down and repeat.

When a result is wrong, tie it to the build, the device, the OS version and the session recording. A failure you cannot tie to a build and a device is a failure you will be asked to reproduce.

Check: Record whether the same draft reopened with the text you entered on each platform.

5. Test how the app handles the OS

Every app depends on the OS for permissions, its lifecycle and updates, and hybrid apps do too. These checks cover that relationship.

  • Permissions. Deny camera access and check that the user can continue or recover. Then grant camera access, revoke it in Settings and open the app again. Try the camera and check that the user can recover.
  • Interruptions. Take a call or a notification during a form. Background the app during a draft and resume it. The draft should still be there.
  • Process death. Put the app in the background. On Android, run adb shell am kill <package> and verify that the old process exited. For an iOS restoration test in Xcode, background the app, then stop it from Xcode. Relaunch and check the documented restore behavior. Backgrounding and process death are different tests and fail differently.
  • Upgrades. Create a record in the last release. Install the candidate over it. Reopen the record.
  • Network changes. Switch from Wi-Fi to cellular during submission. If the app reports success, check that exactly one record exists. If it reports a failure, reconnect and retry. Check that the retry leaves one record.
  • Power and system state. Test under iOS Low Power Mode and Android battery saver, where background work is throttled. On Android, watch for an ANR, where the app stops responding without crashing.
  • Push notifications. Send a test notification while the app is in the background. Tap it and check that the correct record opens. Repeat with a delivered notification and no app process running when you tap it.

Emulators and simulators can reproduce many of these conditions. Where you can, add a physical-device check of delivery, hardware behavior and timing. The yes/no release checks live in our mobile app testing checklist.

Check: Record what happened to the draft after an interruption, a process restart and an upgrade.

6. Automate the stable journeys

Automate the journeys that run on every build and rarely change. Keep exploratory work and first passes on new features manual.

A video and a log prove a test ran. They do not prove the saved state is correct. Every automated journey needs an assertion on the result. Here is one, written out:

  1. Sign in with a test account.
  2. Save a draft with text unique to this run.
  3. End the app process and launch the app again without clearing its data.
  4. Pass if the draft opens under the same account with that text.
  5. Record the build, device, OS and result.

Let the framework wait for work it tracks. When the test still needs to wait, give it a time limit and a condition, such as the saved draft appearing. Skip fixed sleeps. Give each parallel run its own test data, so two devices never edit the same draft. Then run the set across your device list in parallel. One workable split is a small primary set of devices on every build and the wider list before each release candidate.

When an automated journey fails, save the first failure and check what the user saw. If the evidence shows the app lost the draft, report it. To reproduce the failure, reset the test data and rerun on the same build, device and OS. If the retry passes, investigate what changed across the two runs.

Scriptless sessions replayed on iOS and Android need a baseline per platform. Our mobile app automation testing guide covers building the suite.

Check: On each device in the run, record whether the automated check found the draft and matched its text.

How a test reaches each screen

The six steps cover screens your test can see as native controls. Some journeys open a web form or browser. Others stay on the same screen, but the control you need is missing from the native tree. Inspect the control first, then choose how to reach it.

App typeWhere the seam isHow a test reaches itWhat to validate on hardware
NativeSystem dialogs, permissions, other appsPlatform tools or Appium in the native context; UI Automator for system UI on AndroidPermission prompts, interruptions, process death, upgrade over existing data
HybridThe native shell hands off to a WebView the app ownsSwitch to the web context for the page, then back to the native contextPlugin calls, the WebView provider version, the result back in the shell
Native app with web screensOne embedded form, such as a claim or paymentThe same WebView procedure, for that screen onlyThe record created in the form appears in the native screen
In-app browserA Custom Tab or SFSafariViewControllerNative automation on the exposed browser controlsSuccess and cancellation, and the app state on return
React NativeJavaScript renders native viewsStay in the native context and locate by test IDIDs on both platforms; controls replaced after a re-render
FlutterFlutter draws its own widgetsSemantics identifiers in a release build; Flutter drivers need an instrumented buildFind the submit control by its semantics identifier, tap it and check that the claim appears
Mobile web and PWAThe browser and the OSBrowser automation for the page; device controls to install and launchHome-screen launch after installation, offline behavior if supported, and updates to an existing installation

To work out which row you are on, ask one question: what can your test see on this screen? Start in NATIVE_APP and inspect the control you need. Stay there for exposed native controls, including React Native controls and Flutter semantics. Switch to a discovered web context only when you need its DOM. A screen can look native and be a web page, or look like a web page and be native, so confirm the framework from the app code or the team that owns the screen.

Hybrid app testing: WebView contexts and inspection

Hybrid app testing covers the native shell, the web content inside it and the handoff between them. Appium drives the shell in NATIVE_APP. To work with the page itself, select the web context that exposes it. You switch between them with Appium’s context API. The same procedure applies to a mostly native app with one or two web screens.

Reaching the WebView, and what to check when you cannot

The procedure:

  1. Open the web screen.
  2. Poll the available contexts until the expected web target appears. It can appear after the screen does.
  3. Select the returned WEBVIEW_ context for your app. If it contains several windows, choose the one with the expected URL or page content. Context names and page handles vary by driver, so check the page, not just the name.
  4. Wait for the claim form, fill it in and submit it, using CSS locators inside the page. Note the claim number from the confirmation.
  5. Follow the return path a user takes. Switch to NATIVE_APP for the native controls, then check that the claim list contains that number.

Two different failures hide behind “the WebView test broke.” Tell them apart by what you see.

The context never appears. If only NATIVE_APP comes back, the driver cannot see a debuggable page. Check that the page has actually loaded. Check that the device’s inspector can see it. Then check that web debugging is enabled in the build you installed. Store builds ship without web debugging unless the team turned it on, so a test that worked in a simulator can fail here on a real device for that reason alone.

The context appears, but the switch fails. On Android, switching starts Chromedriver, and Chromedriver has to be compatible with the Chromium version inside the device’s WebView. Check that the Appium server has a compatible Chromedriver. The UiAutomator2 driver’s hybrid mode documents how it detects and selects one. Our list of common Appium errors covers the Android error messages you will see.

You do not need to switch for everything. A web input accepts text through WebDriver, and focusing it or opening the keyboard does not by itself need a context switch. A native permission dialog that appears over the page is handled in the native context. Then the test returns to the page if the journey continues there.

Inspecting the WebView on Android and iOS

Inspection is how you write a locator that works and how you find the cause of a failure at the handoff. Look at the DOM for locators, the console for errors and the network panel for requests that failed without showing anything in the native UI.

Android. Enable web debugging in the test build. In WebView 113.0.5656.0 and later, it is on by default for a debuggable app. Otherwise, call WebView.setWebContentsDebuggingEnabled(true) in the test build. Never ship that call in a production build. Connect the device through ADB and open chrome://inspect/#devices in desktop Chrome.

iOS. For an app built with a current SDK running on iOS 16.4 or later, set webView.isInspectable = true on the WKWebView under test. It defaults to false, and it is set per web view. On a current iPhone, open Settings > Apps > Safari > Advanced and turn on Web Inspector. For an Appium run on a real iPhone, turn on Remote Automation there too. On the Mac, enable “Show features for web developers” in Safari’s Advanced settings. Connect the iPhone and choose the device and page from Safari’s Develop menu. Apps built against an SDK older than iOS 16.4 keep the older behavior, where debug builds from Xcode are inspectable.

Cloud devices. A hosted test session does not put the device in your desktop Chrome or Safari by itself. You need the device platform’s supported remote connection. On Kobiton that is virtualUSB. An organization admin enables it on the device’s host machine. It works with private or local devices only.

Plugins and WebView versions

Hybrid apps reach the camera, files and location through plugins. Test each plugin call twice: once for success and once for a denial or cancellation. Then check what the calling screen received. A plugin that fails quietly leaves the web page waiting for a result that never comes.

On Android, the WebView is supplied by a separate system component that updates independently of the OS. Two devices on the same Android version can run different WebView versions. When a web screen fails on one device, record the WebView provider and version with the failure. Which versions to cover is a compatibility question, handled in our compatibility testing guide.

Native apps with web screens and in-app browsers

Plenty of native apps have one or two screens that are web pages: a claim form, a payment step, a profile editor. The web team builds and tests the form. The mobile team builds and tests the screens around it. Both teams’ tests can pass while the user never sees the result.

Take an embedded claim form. The web team’s test confirms the form submits. The mobile team’s test confirms the app opens the form and returns to the claim list. Neither proves the claim reached the list. The check that does: submit a test claim, return to the native claim list and confirm the same claim number appears there. That check covers the contract between the two teams. Give it a named owner.

When the number is missing, look at the seam first. Check whether the server accepted the claim and which account it belongs to. If it exists, trace the return to the app and the refresh of the native list. Run the same check after a failed submission, too. The app should show the error, not an empty list.

In-app browsers are a different case. They can look embedded, but the browser owns the page, not your app.

  • Android. A Custom Tab runs in an Android browser.
  • iOS. An SFSafariViewController presents a Safari-managed page. Your app has limited access to what happens inside it.

An Android sign-in flow can open a Custom Tab. On iOS, a web sign-in flow can use ASWebAuthenticationSession to return the result to the app. Use native automation for the browser controls the platform exposes. Use DOM locators only when the browser exposes the page as an inspectable target your driver can attach to. Test both success and cancellation. On return, check that the app shows the signed-in account, or the recovery screen if the user backed out.

Testing cross-platform apps: React Native and Flutter

Cross-platform apps share code across iOS and Android. React Native renders native views. Flutter draws widgets and exposes controls through semantics. Use native automation for controls the platform exposes. If the app embeds a WebView, use the WebView procedure for that screen.

React Native: test IDs and what Appium sees

A testID is how a React Native view is located in end-to-end tests. Forward a unique testID to the control the user acts on, not to a wrapper around it. Then locate it per platform:

  • iOS. Use Appium’s accessibility id strategy for that identifier.
  • Android. Use the id strategy, which matches the exposed resource-id. Appium’s accessibility id strategy on Android looks up content-desc, which is a different attribute.

For a submit button with testID="claim-submit", inspect the Android node and check its resource-id, then inspect the iOS node and check its identifier. On iOS, find claim-submit by accessibility id. If Android shows the bare resource ID claim-submit, set UiAutomator2’s disableIdLocatorAutocompletion setting to true and find it by id. If Android shows a package prefix, use the full ID you inspected.

Keep accessibility labels written for people. Screen reader users hear the label. A label like “btn_submit_2” is a test ID in the wrong place.

React Native can replace a control during a render. When that happens, the element your test is holding goes stale. Find the control again, wait until it is visible, act on it and check the result.

A testID can also change the view tree. React Native’s documentation notes that setting one disables an optimization that removes layout-only views. I hit what looked like this in a React Native app I build. On the same Galaxy S22, the scroll check reached the field in the earlier build. After I added a testID to the ScrollView, the later run gave up after 20 scroll attempts. I suspected the selector was now matching a different view. The test harness also changed between the two runs, so treat this as a lead, not proof. When a scroll or search breaks right after you add IDs, check which view your selector now matches.

Detox is the gray-box option for teams working in the React Native repo. Detox waits for tracked app work to settle. It runs on Android devices and emulators and on iOS simulators.

Flutter: release binaries and instrumented builds

Flutter draws its own widgets, so a native test sees only what Flutter exposes through its semantics tree. Which Flutter test you can run depends on which build you have.

A release build. Test it with UiAutomator2 or XCUITest against the exposed controls. Giving a control a Semantics(identifier: ...) exposes it as a resource-id on Android and an accessibility identifier on iOS. The identifier is not shown to users. Keep the visible label readable.

Tests in the Flutter repo. In Flutter’s integration_test, give the widget a ValueKey and find it with find.byKey. Keys are Flutter widget identifiers. They do not appear in Appium’s native tree. Standard integration_test alone cannot operate OS permission dialogs.

The same submit button shows the difference. ValueKey('claim-submit') serves find.byKey inside the widget tree. A native release test needs an exposed node, such as one identified by Semantics(identifier: 'claim-submit', ...). For a bare Android resource ID, turn off UiAutomator2’s ID autocompletion before looking it up. After you add it, inspect the node and check that a tap on it actually submits.

Appium’s Flutter drivers. Both need an instrumented build. The Appium Flutter Driver needs enableFlutterDriverExtension() in the app and a debug or profile build. The Appium Flutter Integration Driver needs its test server and a dedicated test entry point. Neither runs against a plain build from the store.

Mobile web apps and PWAs

Mobile web apps and progressive web apps (PWAs) run in the browser, so the browser and its engine join the device as a variable. Device memory, input and connectivity still matter.

Run the journey in the mobile browsers you support. For an installable web app, install it and launch it from the home screen. If it supports offline use, try the journey offline and reconnect. If it uses a service worker, check that an existing installation receives the update.

That is the short version. Our guide to testing a mobile website covers it in full, and real mobile browser testing covers real-device browsers.

Native mobile app testing FAQs

What is native mobile app testing?

Native mobile app testing checks how an app built for iOS or Android behaves with that platform’s controls, hardware and services. For example, deny camera access or install an update over an existing account and check the result. It runs on the devices and OS versions your users have, with XCUITest on iOS, Espresso, Compose UI tests or UI Automator on Android, or Appium across both. Each test starts from a known state and ends with a result you can check in the app.

What is hybrid app testing?

Hybrid app testing checks the three parts of an app that runs web content inside a native shell: the native UI, the web pages and the handoff between them. Hybrid mobile application testing uses the same tools as native testing for the shell. With Appium, drive the shell in the native context and switch to the web context when the test needs the page’s DOM. The test that matters most crosses the handoff. It acts in the web page, returns to the native screen and checks that the result arrived.

Why can’t Appium find or switch to the WebView?

It depends on which failure you see. If only NATIVE_APP appears, the driver cannot see a debuggable page. Check that the page has loaded, that the device’s inspector can see it and that web debugging is enabled in the build you installed. If the web context appears but the switch fails on Android, check that the Appium server has a Chromedriver compatible with the Chromium version inside the device’s WebView.

How do you test a React Native app with Appium?

Forward a unique testID to the control the user acts on. On iOS, find it with Appium’s accessibility id strategy. On Android, find it with the id strategy, which matches the resource-id; Android’s accessibility id looks up content-desc instead. For a bare Android resource ID, turn off UiAutomator2’s ID autocompletion before looking it up. Keep accessibility labels useful for screen reader users. Find a control again if a render replaced it, wait until it is visible, act, and check the result on both platforms.

Can one test cover native, hybrid and web screens in the same app?

Yes, with Appium. Stay in the native context for every control exposed as native, including React Native controls and Flutter semantics. Switch to a web context only when you need a web page’s DOM, then switch back and check the result in the app. If a team already uses Espresso, Espresso-Web reaches an owned web form on Android. On iOS, XCUITest sees web content only through the accessibility elements it exposes, not through the DOM. Detox suits teams testing inside a React Native repo.

Start with the handoff that matters most

Pick the handoff where a lost result would hurt a user. Name the owner. Write down what the app must show after success and after cancellation. Run those checks on the devices you support.

For how this fits into the rest of your testing, start from our guide to what mobile app testing is. To run these checks on real iOS and Android devices, see real device testing on Kobiton.

REAL-DEVICE RELEASE GATE

Sign Off Releases On Real iOS And Android

  • Run XCUITest, Espresso, and Appium on real hardware
  • Test permissions, interruptions, upgrades, and push notifications
  • Tie every failure to a build and device
Release pipeline dashboard with real-device test stages Release Pipeline Build #482 Real-device test run ✓ Build Signed ✓ Unit 412 pass ● UI Running Release Waiting OS Handoff Checks 6 of 7 pass Android 14 Mid-range Pass iOS 18 Flagship Pass Android 13 Low-memory 1 fail Permissions Pass Interruptions Pass Upgrade over data 1 issue Push notifications Pass Start Session Framework XCUITest Espresso Appium UI Automator 3 devices connected Build #482 · main Release Gate

Interested in Learning More?

Subscribe today to stay informed and get regular updates from Kobiton

Ready to accelerate delivery of
your mobile apps?

Request a Demo