Triggering code when tests complete
In Version 3.0.2 and later an additional Settings tab has been added to the XJRunner Setup screen in XJDeveloper. This tab, labelled “Functions”, includes the options of having a function which gets run after every test function completes (a post-function function), as well as a function that gets run after all testing completes (a post-testing function).
The post-function function is run after each selected test function in the list no matter how the function completes or is terminated. The selected function must be a function with two input arguments and no outputs:
PostFunction( INT stopMode, INT result )()
stopMode indicates the reason why the test ended. For example this could be because the function returned, or it could be because the user pressed the stop button. The
result indicates the return value from the completed test function.
This can be useful when a custom log file is required. For example, the following code will append a line to a CSV file with the result from each test as it completes:
The post-testing function is run once after all selected test functions have been completed. The selected function must be a function with two input arguments and no outputs:
PostTesting( INT stopMode, INT failureCount )()
stopMode indicates how the tests terminated overall. For example this could be because all the functions completed normally (although some tests may have failed), or it could be because the user pressed the stop button. The
failureCount indicates how many test functions failed.
This can be useful when particular actions need to occur to complete the testing. This can include resetting or powering-down the board being tested, or appending an entry to a summary log file keeping track of the final result for each board tested.
On the Functions tab there is also a check box “Run after log file has been written”. When this is not selected, any text printed to the screen during the post-testing function will also be added to the active log file. In this mode, the contents of the log file should not be manipulated from within the post-testing function. If the post-testing function needs to use the contents of the log file then this check box should be enabled. In this mode, the post-testing function can still print to the screen but this text will not be added to the active log file. This then enables the log file to be used in various ways. For example it can be copied to a server:
Alternatively, the log file can be printed:
This uses Notepad to print the log file, so the font used can be altered by running Notepad and changing the font on the Format menu. Close Notepad and then the same font will be used to print all log files in the future.
Note: by default connection test is set to the most verbose level of error detail. If many connection errors are detected then this can produce a long log file. To avoid creating such long files, the Error Detail Level can be changed to provide less detailed information.