Running a Function After Each Test or After All Tests

It can sometimes be useful to run a function after each individual test, for example if you want to copy the pass/fail result of each test into your own file. A function that runs after every test is known as a post function.

There are also times when it is useful to run a function after testing has finished. For example, you may not wish to keep the log file if the board has passed, in which case running a function that records the pass in a separate database and then deletes the log file may be useful. Alternatively, you may wish a test failure to cause the log file to be moved from the production results database to the QA one; or for repeated failures from one tester to initiate an alert. A function that runs after all the testing has completed is known as a post-testing function.

There is also an option that determines whether the post-testing function runs before or after the log file has been written. The above examples use the option to run it after the file has been written.

Selecting the XJEase functions to be run at those times is done in the Functions tab of Figure 11, where they are selected from a list of those available. For a function to be used in this way, it must be in a circuit code file and must meet the following criteria:

  • Has only two input arguments, both of which are integers
  • Has no output arguments
  • Is defined as GLOBAL

The input arguments differ between post functions and post-testing functions:

  1st Input Argument 2nd Input Argument
Post Functions: A value that details how the preceding test completed The test’s pass/fail result
Post-Testing Functions: A value that describes how the overall test list completed A count of how many test functions failed

Table 2: Input Arguments for Post and Post-Testing Functions

The value used for the first input parameter is the StopMode, and the possible values it can take are described in the XJTAG Help system for post-functions and post-testing functions.

  • StopModes are defined as global constants in globals.xje, allowing a function to refer to them by name rather than by their hexadecimal value

To add a post-function, select it from the pull-down menu (2) as shown in Figure 11 below. Note that it will run irrespective of how the test ended (whether it passed, failed, was aborted etc.).

To add a post-testing function, select it from the pull-down menu (3). It will run irrespective of how the test sequence finished (e.g. it will run if all the tests passed, if some of them failed, or if the user aborted testing).

1: Select the Functions tab 2: Pick a function from the dropdown menu to be run after each test 3: Pick a function from the dropdown menu to be run after testing is complete 4: Tick to make the post-testing function run after the log file is created

Figure 11: Defining Functions to Run After All Tests or After Each Test

To set the post-testing function to run after the log file has been written, add a tick in the Run after log file has been written checkbox (4) indicated in Figure 11 above. This would be used if the function needs to act upon the log file (for example to move it). Running before the log file has been written has the advantage that any text output from the post-testing function can be added to the log file.

  • The Functions tab also allows Board Initialisation functions to be set. However, these are not used in the test list or in XJRunner, and are only run when in the Debug Connection Test screen or in XJAnalyser.