Soundboks makes Bluetooth speakers controlled by a phone app, including features such as equalizer settings, speaker locking, and linking multiple speakers. Its Appium setup tested real phones and speakers, but about 15 scenarios took two and a half hours to run across devices. Runs could also fail inconsistently, slowing feedback on pull requests.
Sub-second integration tests for your RN app & Bluetooth device
Speaker
Lars Thorup, a freelance software engineer and open source developer from Denmark, explains how he built fast integration tests for React Native apps communicating with Bluetooth devices, drawing on work with Soundboks.
Handwritten mocks for react-native-ble-plx were hard to maintain and could keep passing after the device protocol changed. Thorup’s alternative records actual Bluetooth traffic from the app and device into JSON files, then reuses those recordings in Jest tests. The result retains messages observed in real device interactions while running without physical hardware.
A lightweight React Native recorder app runs on a phone against the real device and captures commands and events. App tests load the recording, render screens with React Testing Library, and advance through labeled points to check behavior. Thorup showed a connection test that exchanged around 50 BLE messages and ran in about 200 milliseconds.
Recordings can use a canonical device ID so developers’ local devices do not create noisy file changes. For values that vary, such as battery level, the recorder can save a chosen canonical value while tests still check the actual reading against expectations. Teams can add handwritten traffic for boundary cases, and debug translations make UUIDs and encoded values easier to inspect.
Takeaways
- Use recordings of real device traffic to make integration tests fast enough to run frequently.
- Keep a small set of end-to-end tests for real-world timing and wireless behavior, while using recorded traffic for most automated checks.
- Canonicalize device IDs and variable values to keep recording diffs stable across developers and runs.
- Pair recorded integration coverage with handwritten cases for boundaries and combinations.
- Add labels and readable debug translations to make BLE recordings easier to control and investigate.
Mentioned in this talk
Search inside this talk
What was claimed 8
- featureSoundboks: Produces portable Bluetooth speakers controlled by an app
“a Danish company producing really awesome Bluetooth speakers that you can carry around”
YouTube Unverified1 source· Talk
- metricAppium: End-to-end scenarios generally take one to five minutes each; running all tests on all phones takes two and a half hours
“one to five minutes per scenario ... the total time to run all the tests on all the actual phones is now two and a half hours”
YouTube Unverified1 source· Talk
- uses
“at Soundboks we use the quite popular library called react-native-ble-plx”
YouTube Unverified1 source· Talk
- integrates withReact Native BLE PLX Mock Recorder integrates with react-native-ble-plx
“apply it specifically to the React Native BLE PLX library”
YouTube Unverified1 source· Talk
- featureReact Native BLE PLX Mock Recorder: Records actual BLE commands and events to JSON files for replay in app tests
“record traffic with the device and store those recordings in a JSON file in our Git repository”
YouTube Unverified1 source· Talk
- metricReact Native BLE PLX Mock Recorder: A test exchanging around 50 BLE messages runs in about 200 milliseconds
“We exchanged around 50 BLE messages, and the test runs in about 200 milliseconds”
YouTube Unverified1 source· Talk
- integrates withReact Native BLE PLX Mock Recorder integrates with Jest
“the first few lines read the JSON file with the recording and configure the BLE manager to use it as a mock”
YouTube Unverified1 source· Talk
- built
“the tool this talk is about, called React Native BLE PLX Mock Recorder”
YouTube Unverified1 source· Talk






