Creating a Traffic Light in MicroC : Exercise 7 - Using the Test Driver

Exercise 7 - Using the Test Driver

This exercise describes how to test the dynamic behavior of the developed application
non-interactively, using test vector inputs and outputs.

1.
Select Options > Settings from the MicroC Profile window to open the Properties for Code Generation window.
2.
Select the Test Driver tab and then check the Enabled check box.
3.
4.
5.
Select Tools > Open GBA from the MicroC Profile window.
6.
Click Execute Compiled Code from the MicroC Profile window and when the panel is available press the CHANGE push button any number of times. Within the Command Prompt you can view the Test Driver data stream output.
7.
8.
Dos_box.bat File
Note:
Setting these environment variables redirects the standard input and output to files, making it possible to post-process the results.
9.
Select Tools > Open GBA from the MicroC Profile window.
10.
Click Execute Compiled Code from the MicroC Profile window.
11.
Within the Run Command window, select the dos_box.bat file.

A Command Prompt window opens as a result. See the following figure.
12.
13.
Click the CHANGE push button any number of times when the panel is invoked.
Note:
Each time you click the CHANGE push button, information is written to the files TESTDRIVER_INPUT_FROM_PNL_FILE.txt and TESTDRIVER_OUT_FILE.txt. These files can be viewed once the model execution has been stopped.

The files are both of a similar format and are explained in the following tables.

 
 
14.
Edit the dos_box.bat file to enable the line that was commented out.
15.
Rename the file in the code directory called TESTDRIVER_INPUT_FROM_PNL_FILE.txt to TESTDRIVER_IN_FILE.txt.
16.
Modified TestDriver In File
17.
Click Execute Compiled Code from the MicroC Profile window.
18.
Select the dos_box.bat file in the Run Command window. A Command Prompt window opens.
19.
Enter the name of the executable image (in this case, traffic_light_uc.exe).
20.
When the panel is invoked, the TESTDRIVER_IN_FILE.txt is responsible for providing the inputs to the system. The files TESTDRIVER_INPUT_FROM_PNL_FILE.txt and TESTDRIVER_OUT_FILE.txt is created. These files can be viewed once the model execution has been stopped.