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. Click OK.
5.
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.
8. Use a text editor such as WordPad (or Notepad) to create a batch file nameddos_box.bat
in the code directory. See the figure.
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 thedos_box.bat
file.
A Command Prompt window opens as a result. See the following figure.
12. Enter the name of the executable image (in this case,traffic_light_uc.exe
).
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 filesTESTDRIVER_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.
Variable Name Absolute (Default) or Relative See the following table. The new value it is set to.
14. Edit thedos_box.bat
file to enable the line that was commented out.
15. Rename the file in the code directory calledTESTDRIVER_INPUT_FROM_PNL_FILE.txt
toTESTDRIVER_IN_FILE.txt
.
16.
17. Click Execute Compiled Code from the MicroC Profile window.
18. Select thedos_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, theTESTDRIVER_IN_FILE.txt
is responsible for providing the inputs to the system. The filesTESTDRIVER_INPUT_FROM_PNL_FILE.txt
andTESTDRIVER_OUT_FILE.txt
is created. These files can be viewed once the model execution has been stopped.