The Industry 4.0 (I4.0) is a paradigm settled down by the introduction of the Internet of things (IoT) into the production and manufacturing environment. I4.0 promotes the connection of physical items such as sensors, devices, and enterprise assets, to each other and to the Internet. The information that flows through these items is vital because it serves to make relevant decisions. One of the main features of I4.0 is its adaptability to the human needs, this means that the items included in the I4.0 network are heterogeneous and they are large in number. The majority of I4.0 papers, which are focused on testing, describe a specific system or part of the I4.0 network. We have not found any paper that undertakes the testing of multiple connected IoT devices that will receive, process, and make decisions according to the complex and real data that travel through the network. In this article, we present IoT-TEG (Test Event Generator) 4.0, which is based on the test event generator system IoT-TEGĀ . IoT-TEG 4.0 provides two new main contributions: the generation of test cases, which can include all the different types of data that the connected I4.0 devices under study can manage, and real-time testing. Additionally, its validation using real IoT programs is included and the results show that IoT-TEG 4.0 allows us to conduct tests that mimic real IoT system behaviors.