Skip to content

How to create tests for IoT applications

katja-seb edited this page Jul 14, 2021 · 6 revisions

In order to effectively test your IoT application, you should perform the following steps in sequence. To make the execution of the steps clearer to you, the creation and testing of an IoT application is shown using an example.

1. Consider and define a test case regarding your IoT application

Test case

A temperature decrease in combination with an outlier value should be simulated by a temperature sensor simulator. With respect to the IoT application the following rules should be defined:

  • If the temperature is higher than 23°C → activate the air
  • If the temperature drops below 20°C → activate the heating

The test was successful if only the heating is activated by the temperature drop.

2. Define the rules that are necessary for the your IoT-Application

Rule 1:

  • event: One value of the temperature sensor simulator
  • condition: 1 event > 23°C
  • action: activate the aircondition (actuator simulator)

Rule 2:

  • event: One value of the temperature sensor simulator
  • condition: 1 event < 20°C
  • action: activate the heater (actuator simulator)

How exactly to create a rule can be found in the linked How to.

3. Register the new test

Main NavigationRulesTesting-Tool → press the '+' button at the table.

Test case

For the Test registration you have to give a unique name, choose the type of simulator of your IoT-Application to be tested and adjust the configurations for the simulation that should be generated. To define if the test is successful or not in the end, you have to choose whether all the rules that should or should not be triggered through the test.

4. Start the Test and wait until the simulation is finished.

Once the test has been created, it can be started on the test details page, which can be accessed by clicking on the name of the test in the table.

Test case

5. Open the Test-Report

After completion or stopping the test, the user has the possibility to view the Test-Report created in the background.

Test case

This report provides information on whether the created IoT application reacts as expected in the selected use case. To evaluate the success of a test, the comparison of expected and actual results is used. If these match, the test is considered successful. In the course of testing IoT applications, target results are defined by rules that are to be violated or not violated by the sensor simulation. The actual results to be compared refer to the actual violation of the rules of the IoT application by the sensor simulation. Additional detailed information is provided to help you understand the result of the test.

In this case the IoT application does not work as expected. Only the rule Temp<20°C should be violated, because a simulation of a temperature drop has taken place. However, the rule Temp>23°C was also violated, which means that the application does not work correctly and without errors in such a case. To prevent such a behavior, the rules can be adjusted to minimize the sensitivity for such outlier values.

In the case that a test wasn't successful or an error occurred during the test, helpful next steps are listed in the bottom section of the report that can help to correct the behaviour.

6. Export Test-Report

The user has the additional opportunity to export the Test-Report in the form of a PDF file. A button Export as PDF is available in the test report modal for this purpose.

Test case

Test case Test case

7. Repeate a specific test to check if the rule adjustment was successful

If a test is to be repeated with the same generated sensor data, for example to find out whether the rule adjustment was successful, proceed as follows:

Test case

  • Turn on the Rerun Mode in the Test Report overview section. In the background, all necessary preparations are automatically made to repeat the test.

  • Select the specific test to be rerun from the Test-Report overview and click on the repetition button in the table. If the test has already been repeated, the repeat button cannot be pressed.

  • Wait until the test repetition is finished and analyse the Test-Report again.

  • To run a test again with newly generated data, switch off the Rerun Mode.

Clone this wiki locally