In term of architecture there plenty ways to connect to an IoT devices, at least there are:
- Devices connected to a mobile
- Devices connected to a desktop or a laptop
- Devices connected to a cloud solution
Today we will talk about IoT devices connected to a mobile. How these devices are connected?
Mainly they use Bluetooth. If they use Wifi, then they are using a cloud solution as proxy. That means we could categorize them as devices connected to a cloud solution. We will discuss how we could test them in a future article.
Before exploring how we could test them automatically, let gives a few solution examples of IoT devices connected to a mobile:
- Watch connected to a mobile (Apple Watch, FitBit, etc.)
- Beverage cooler and Freezer
- Coffee machine
- Construction tools
- Healthcare equipment
Last point before starting, here will cover the software part of the test. The hardware will be not covered in this article.
- The first challenge is how we get feedbacks from the IoT devices? Mainly the IoT devices have a very simplified interface with a very limited scope of functionality. But when we test, we need to access to a bit more of functionality, like to have access to details logs, have feedback on functional that return nothing, have a feedback when it changes state. Usually the hardware and firmware vendor of the device need to provide board that simulate the hardware but it uses the real firmware as it is a real device. In fact, what we test here is if the firmware is reacting properly as per the specification. And the firmware will interact with the board as it is a real hardware.
- When we talk about mobile phone device, we need to cover a huge number of devices version (hardware and OS). And sometime, the way the Bluetooth works, it could vary between different mobile phone type.
- There are no End to End solution for this type of architecture. You will need to take what already exists and you have developed, then put them together.
Architecture and test
To test this architecture, we could use a Java Test factory based on Appium, Selenium and Rest-Assured. This factory could be driven by a BDD (behavior-driven development) like Cucumber to define the test cases. The only missing part is the machine controller.
As mentioned before the main challenge is to set a Hardware emulator to test the real firmware and have a full access to all input and output logs. This emulator will be handle by a custom developed machine controller. This controller will interface with the device through a serial port and the machine is expected to implement parsing the MCP messages.
Regarding Appium, the setup is required to test a Native or Web application running in a Mobile device.
To test the backend, let assume they are in majority accessible by Web interface or Rest Api. So, the best tool for that are Selenium for the web and Rest-Assured for the API.
The major effort to set this kind of End 2 End test is to set the machine controller, and that could take more than 50% of the time required to setup this environment. What is missing is a standard protocol to manage device through serial. And also, I’m quite sure any time soon this pain will be solved by any major Automated Test Framework leader (HP, Tosca) or by an open-source community. But in the meantime…good luck!