react-native-ble-plx-mock-recorder
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

react-native-ble-plx-mock-recorder

Build Status

Mock recorder and playback tool for react-native-ble-plx. Enables fast and robust integration tests for your Bluetooth/BLE app.

Overview

This tool will help developers of React Native apps that talk to Bluetooth/BLE devices. Avoid having a lot of slow and fragile end-to-end tests taking more than an hour to run on physical devices and a physical CI server!

If you can run your UI tests with pre-recorded BLE traffic, you get very fast and robust tests, that are actual integration tests, since you are not writing your mocks by hand.

You will create a separate mock recorder app, using the "react-native-ble-plx-mock-recorder-mocha-template" template for React Native to occasionally record actual traffic needed by your tests.

Then use this library to play back the BLE traffic every time you run your Jest UI tests, and enjoy the speed of up to 100 of tests per second.

For more information, check out the blog post.

Prerequisites

Demo

npm install
npm run demo:app
# then close the app and the Metro popup terminal window
npm run demo:recorder
# from here on you can unplug phone and power down BLE device
npm run demo:app:test

Getting started

To get started, read how to build your own demo from scratch. Then apply the same steps to the app you would like to test.

API

TODO

Architecture

See ARCHITECTURE.md

Limitations

Currently a large part of the central API of react-native-ble-plx is implemented, but several methods which have not been needed yet, are missing. They should be easy to add. Feel free to submit a Pull Request!

Contributing

Contributions are welcome! Please open an issue with your suggestions and/or submit a PR. PRs should pass npm test and not decrease code coverage.

Contributors

@larsthorup
@larsthorup
@muscapades
@muscapades

Publish to npm

# git commit && git push
# wait for CI to pass
# clean workspace
git checkout main
git pull
npm run test:e2e
npm run bump
npm run publish
# git commit && git push

Then manually verify local react-native-ble-plx-mock-recorder-mocha-template and publish that.

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-ble-plx-mock-recorder

Weekly Downloads

24

Version

0.0.6

License

MIT

Unpacked Size

94.1 kB

Total Files

20

Last publish

Collaborators

  • larsthorup