# A TDD Framework for Automated Monitoring in Internet of Things with Machine Learning +
## 6 Discussion  
The proposed framework and the TDD tool built with the K-Means algorithm could provide a rationale for the remote lab and smart home study cases, considering an end-to-end view. The RM-ODP standard was essential to provide a link between business drivers and non-functional requirements, and an approach to use the automated monitoring tool with the objective to analyze and assist in the IoT solution development process. Some benefits found in the study cases: in the remote lab scenario the deployment and free memory conditions for devices with extended functionality were elucidated, and in the smart home scenario the status of 13 different firmware versions could be evaluated in an automated way, and provide insights for the monitoring frequency configuration. The different conditions of the study cases show that our approach is not limited to specific scenarios or proprietary technologies. The study cases cover private and cloud computing environments in Brazil and USA, HiveMQ and Mosquito MQTT brokers, SQL and No-SQL databases, and ESP8266 and ESP32 devices. The proof of concept was performed with these IoT development boards, but any board that supports the MQTT protocol might be integrated with the proposed TDD framework. Another contribution is related to the applicability of the proposed method, considering that the proof of concept is open source for facilitated replication, and the communication is based on the open source standard MQTT [26]. The scripts for ESP32 and ESP8266 modules are, therefore, compatible with any cloud provider that implements the MQTT protocol, so our approach is compatible with any cloud back-end, minimizing the vendor lock-in problem. The PubSubClient library used for the device MQTT connection is also open source, unlike the Amazon Web Services (AWS) library only compatible with AWS back-end. The validation of the proposed method with real devices might contribute to close the gap between proposed TDD methodologies and their effective application. We also expect that the proof of concept contributes as an example of using machine learning to generate automated tests for IoT. However, a limitation of the proposed solution is that the automated tool must be trained in each different deployment scenarios for accurate assessment results. For example, in the remote lab the Internet connection could provide a remote clock sync in a faster way \begin{table}
\begin{tabular}{c c c} \hline \hline
**Firmware** & **Kmean** & **Count** \\ \hline ArCond2 & 0—bad & 16,384 \\ \hline R4x2 & 0—bad & 53,644 \\ \hline R4x2o & 1—good & 51,049 \\ \hline R4x4 ir & 0—bad & 11,242 \\ \hline R4x4 ir & 1—good & 13,343 \\ \hline R4x4 ir5 & 1—good & 47,458 \\ \hline R4x4o & 1—good & 25,494 \\ \hline RM & 1—good & 112,168 \\ \hline RM1 & 1—good & 84,060 \\ \hline RM1t10o & 1—good & 59,498 \\ \hline RM6 & 0—bad & 21,886 \\ \hline RM8 & 0—bad & 24,329 \\ \hline TV4x2 & 0—bad & 54,758 \\ \hline  & 1—good & 76 \\ \hline WifiModem & 1—good & 20,165 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Smart home ESP8266 clustering results. than in the smart home scenario, so an IoT device developed for the remote lab may not perform well in the smart home scenario. Considering the most relevant related work found in the literature regarding IoT testing, [10] shows an overview of the challenges that arise when testing large IoT applications at the system level. They present a novel hybrid-simulation-based testing approach, and introduce various solutions to the challenges that arise when implementing this hybrid methodology. These challenges are mainly related to the IoT development pipeline, synchronization between real-life and the simulation environment and the scalability constraints of modern simulation techniques. The concept of hybrid simulation is to combine a complex behavior, represented by testbeds, with a more homogeneous behavior represented by simulation. Although it mentions that machine learning can be used, the article does not comment that it may have adopted such a solution.