Test Script Generation with the Test Script Recorder

As the implementation of fully automated tests is normally a rather time-consuming task, many projects still rely on manual testing in order to meet their typically tight time schedule. However, during regression testing (e. g. due to new releases), these manual tests are again very time-consuming and thus expensive.

The redBlocks Simulator offers a simple answer to this dilemma: its built-in test script recorder. It can create fully automated test scripts by recording the sequence of actions during manual test execution. These test scripts can later be used to re-run the very same tests. Thus, by recording the manual tests once, you end-up with fully automated integration tests that can be run over and over again during regression testing without any manual interaction.

 

Test Automation

 

Creating test scripts with the redBlocks Simulator’s test recorder is really easy:

  • Select the peripherals that need to be observed in the test step. The recorder generates test conditions for only the selected ones. Thus, only those peripherals that are relevant for the test step are evaluated and all others are ignored (e. g. debug logging).
  • Start the test recorder and stimulate the system by operating the GUI controls (e. g. press buttons, modify inputs, send data via a terminal, …).
  • During test recording the simulator creates Python code for all user actions and inserts test conditions based on the system’s reactions for all observed peripherals.
  • The generated code is a complete test script that is easily readable. It can be saved to a file and be used for testing without any modifications or it can be enhanced / changed, if needed. For instance, it is easily possible to accelerate the user actions, so it will run faster than the manual actions were performed during recording.
  • The generated test scripts can be assembled to test suites that may be run fully automated without any user interaction.

 

Test Recording

 

 

The concepts of the generated test code and the redBlocks Simulator's test script library were specifically designed to the needs of Embedded Applications and basically rely on the same conceptual pattern as manual tests, i.e. each test step consists of the following parts:

  • stimulate (e.g. change some input)
  • observe (wait a little and watch the reaction of the tested application)
  • evaluate (compare the observed behavior to the expected behavior)

It is important to understand, that it is often not sufficient to check the current state of an embedded application only at certain points in time. In order to illustrate this fact, the following signal curve shows a digital output that changes its value between t2 and t3 from low to high. A test that checks the current state of this digital output at t1, t2, t3 and t4 is certainly not sufficient, because a pulse between t1 and t2 will go undetected (see lower curve).

 

Example Signal Curve

 

The redBlocks Simulator's test script library and the generated test code take issues like this one into account. Thus, the generated code does not only check the observed peripherals for all expected system reactions, but also if they are left unmodified in between.

Details on these concepts can be found in the redBlocks Simulator’s documentation that is included in the redBlocks Eval Package.

 

In this video you can watch the redBlocks Simulator's built-in test recorder in action.