iot concept art illustration
April 10, 2017

IoT Testing for BLE Protocol

Digital Experience

The IoT market is blooming, and so is the necessity for IoT testing. IDC projected in their last report that IoT spending will reach US $1.29 trillion in 2020. Other analysis show the number of devices and usages will be growing dramatically in the next few years:

Internet of Everything

What is the Internet of Things?

IoT is a very wide trend and refers to physical objects which wirelessly connect to networks using different protocols like WiFi, ZigBee, cellular and BLE.

One of the reasons for the IoT growth is the mobile devices which manage the interfaces to IoT devices. The combination of sensor data and smartphones creates wide opportunities for very useful applications.

Many of perfecto’s enterprise customers have been approaching us to support their IoT use cases, raising the demand for IoT support and the ability to automate the full interaction between IoT and mobile devices.

In this upcoming blog series, I will examine some of the IoT use cases and share some best practices in automating for these scenarios.

BLE Protocol-The Basics

In this article, I would like to focus on BLE (Bluetooth Low Energy) devices. BLE protocol is based on Bluetooth v.4.0. With low power consumption, devices can run on a small battery for five years.

The healthcare and lifestyle market is very advanced with regard to IoT apps. BLE sensors can measure any parameters from any person, showing the data directly on the mobile device, which also analyzes the data and suggests the different actions that need to be taken based on the data.

The application types vary from heartbeat data during sport activities to the glucose level in diabetes patients. This IoT solution certainly encourages people to do more sport, but can also improve the quality of life of diabetes patients.

The following figure show the data flows between an IoT device connected to a person via a mobile app to the backend server.


IOT Testing

The medical data is collected by the IoT device and sent via BLE to the mobile app. The app aggregates the data sent it to the server and also can control the BLE device by sending BLE requests. The doctors can query their patients’ data remotely – almost in real time – and get notification of critical situations.

BLE Protocol

BLE protocol based on GATT (Generic Attribute) defines the way that two Bluetooth Low Energy devices transfer data using concepts of Services and Characteristics.

The data is stored in a simple lookup table with id for each entry. The protocol defines the READ, WRITE and NOTIFY actions for these entries.

The protocol defines generic characteristics but also allows us to define private characteristics which require specific code in the BLE device and the Monitor app.

BLE Pairing

Like standard Bluetooth protocol, the BLE requires pairing, but in this case it is done automatically.

The BLE device broadcasts its service and the device which receives the broadcast can ask to connect.

Generic devices accept the connection, whereas other devices will not accept the connection without an authentication handshake mechanism, based on setting predefined private characteristics with a unique key.

After pairing, the devices can exchange data based on the characteristics and the allowed actions using the UUID of the table entries.

Data Flows Over BLE Protocol

The data flow is based on the actions and the characteristics values.For example, heartbeat devices and mobile device data flow (after pairing):

BLE Protocol

IoT Testing BLE Challenges

There are a large number of challenges to developing and testing IoT mobile applications:

  • Most of the tests have to be done manually and requires some form of connection between the IoT device and a real person.
  • The IoT devices and the mobile devices should be in the same location, with a manual interaction to connect between them.
  • It takes more time to develop the IoT HW device and you cannot parallel the application (SW) and the IoT device’s development and testing.
  • The testers cannot control the data sent from the IoT device to the mobile app and set any predefined validation.
  • Health devices and applications require FDA approval, that means large numbers of proven tests on a large number of devices.
  • In the case of offshore testing, it is always a challenge to send and manage the devices in the remote sites.

Let’s take an example of a heartbeat device connected to a finger and send the heart beat to a mobile app.

The app/device tests required:

  • Person / tester - with heart beat and finger ;)
  • Mobile devices
  • IoT device
IOT testing heartbeat

This process cannot be automated – cannot be scaled.

IoT Testing for BLE the Perfecto Solution

Perfecto solution goals are:

  • Automate the test process.
  • Access all the mobile devices in the cloud.

The solution is SW visualization of BLE devices in the cloud.

Allows the user to define and update the characteristics and the services. The services support API and are controlled by automation scripts.

We selected this solution because of the following reasons:

  • Is fully controlled by SW – key for automation.
  • Is located in the cloud near the devices.
  • Acknowledges generic characteristics can be virtually any devices
  • Multi threads
  • Works on real RF channel
  • Allows data to be set by the tester
  • Connects to any automation framework.

How Does It Work?

A new BLE server is added to the lab. This machine contains up to 20 BLE dongles, for each dongle the machine can set a virtual BLE device. The automation server controls both the IoT devices and the mobile devices and allows us to develop a full scenario in an automation script.

IOT Testing BLE Protocol

Each BLE service is configured by an external JSON file. The file defines the services, Based on the JSON file a new visual BLE service started and exposes BLE data.

IOT Testing BLE Protocol

The mobile device receives the data over the RF channel (standard BLE HW on the phone) and works like it arrives from real BLE devices.

The last part of the solution is the commands which are added to the automation system which allows us to start, stop and change BLE servers and data from script.

This solution allows the execution of unattended automation from the CI and to test BLE mobile apps.


BLE devices are one part of the wide topic named IoT. In this article, I described the BLE protocol and the communication layer of the BLE.

I showed how Perfecto virtualization tools overcome the development and testing challenges. In the next article, I will focus on Amazon Alexa and Google Home. I will describe the Alexa skills development and automation processes.