Mobile Development 13 min read

Exploring ByteDance's iOS Automation Testing Driver Tool BDC: Architecture, Features, and Implementation

This article details the background, functional capabilities, development journey, technical architecture, and deployment experience of ByteDance's iOS automation testing driver tool BDC, illustrating how it automates device interaction, app management, UI control, and large‑scale testing on both macOS and Linux environments.

ByteDance Terminal Technology
ByteDance Terminal Technology
ByteDance Terminal Technology
Exploring ByteDance's iOS Automation Testing Driver Tool BDC: Architecture, Features, and Implementation

Background

As business expands, a single app accumulates many features, leading to high code‑change volume (hundreds of merge requests and thousands of modifications daily). Traditional manual testing cannot keep up, so an automated solution is required to convert human interactions (install/uninstall, gestures, key presses, etc.) into atomic operations. This article introduces ByteDance's iOS automation driver tool **bdc** and its underlying principles.

Feature Overview

Device Management

Get connected devices via USB or Wi‑Fi

Retrieve device info (battery, name, …)

Restart or shut down device

Manage developer image

App Management

Install / uninstall apps

List all installed apps

Launch / kill apps, bring to foreground

Get foreground app

Interaction Management

Tap, drag, pinch, zoom gestures

Home, volume, lock‑screen key control

Screen capture

Text input

App UI Tree Management

Obtain UI layout and elements of any app

Handle system pop‑ups

Video Encoding & Streaming

Screen recording and streaming

Trace Collection

Function stack

Thread status

Memory snapshot

Other

Device system logs

Network proxy configuration (HTTP, SOCKS)

Device network status detection

Exploration Journey

Early Solutions

Initially, Android automation relied on adb and STF, but iOS lacked a comparable tool. ByteDance first adopted Facebook's open‑source solutions (wda for UI interaction and idb for app management) to build a basic automation rack.

Problems encountered:

WDA interfaces were slow and could not handle high‑frequency scheduling.

Idb commands were mostly simulator‑only and unstable on real devices.

High failure rates and poor stability made debugging difficult.

Heavy reliance on Xcode made large‑scale deployment costly.

UI Interaction Refactor

We created a more efficient XCTest‑based tool by reviewing XCTest’s low‑level cross‑process APIs, enabling direct calls to the /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport directory where testmanagerd resides. The new interfaces support fast tap, drag, key press, and text input operations, dramatically improving speed and stability over wda.

Device Interaction Tool

After stabilizing UI interaction, we needed robust device and app management. IdB’s undocumented private APIs proved hard to maintain, so we turned to libimobiledevice , an open‑source library that communicates with iOS devices over USB, offering installation, info retrieval, and sandbox file operations.

USB Communication with iOS Devices

Apple’s usbmuxd daemon provides TCP‑over‑USB multiplexing, allowing applications to talk to iOS services without dealing with raw USB protocols. The daemon’s launch daemon file resides at /Library/Apple/System/Library/LaunchDaemons .

Using usbmuxd, we can discover service ports via the lockdownd daemon (fixed port 62078) and then open sockets to services such as afc or house_arrest for sandbox file access.

Service Types

iOS services are split into debug‑related (available after enabling developer mode) and non‑debug services (always present). Debug services are packaged inside Xcode under /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ , while non‑debug services live in /System/Library/LaunchDaemons .

Capability Expansion

Understanding libimobiledevice allowed us to tap into additional Xcode services, enabling trace collection and advanced app management.

Linux Support

To scale to thousands of devices, we containerized each device and its driver using Docker. Because macOS Docker support is limited, we refactored the tool to run on Linux, removing the direct Xcode dependency.

Supporting XCTest Launch

We wrapped XCTest APIs in a lightweight app exposing a WebSocket server. By registering the app’s PID with testmanagerd via lockdownd , the app gains permission to invoke XCTest, enabling full automation from Linux containers.

Running Results

After more than a year in production, bdc powers ByteDance’s automated testing platform, handling thousands of iOS devices and tens of thousands of test executions daily across stability, UI, performance, and unit testing scenarios, serving hundreds of business lines worldwide.

mobile developmentDockeriOSLinuxAutomation Testingdevice managementUI Interaction
ByteDance Terminal Technology
Written by

ByteDance Terminal Technology

Official account of ByteDance Terminal Technology, sharing technical insights and team updates.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.