@testfunction Tag

Marking an XJEase function with a @testfunction tag allows the function to be automatically added to the XJRunner test list. If the file is a test device file, then the function can be added as a test using either the Suggested Categorisation dialog or the Configure Test Device dialog. If the file is a circuit code file, then it can be added as a test using the Suggest Tests... button on the XJRunner Setup Screen.

NB: Test functions must be globally accessible and have a single INT return value. If a function using the test function tag does not match these criteria, then the function cannot be added to the XJRunner test list, and a warning will be added to the project.

It is also possible to use the @testfunction tag to specify whether or not a test should be set to run by default. This can be achieved by providing an argument to the tag: defaultenabled will set the function to run by default, whereas defaultdisabled will initially prevent the function from running. Therefore, in the following example, the function could be automatically added to the XJRunner test list, but would initially be disabled:

/// Flashes the LED and asks the user to confirm its operation via a message box.
///
/// @param result Returns RESULT_PASS on success
/// @testfunction defaultdisabled
///
GLOBAL Test()(INT result)
  // ...
END;

@groupName Tag

It can be useful to be specify the name of the group in the XJRunner test list to which the test function should be added. To do this, use the @groupname tag in combination with the @testfunction tag:

/// Flashes the LED and asks the user to confirm its operation via a message box.
///
/// @param result Returns RESULT_PASS on success
/// @testfunction defaultdisabled @groupname LED Tests
///
GLOBAL Test()(INT result)
  // ...
END;

When the test is added to the project, if there is an existing group with the given name in the XJRunner test list, then the function will be added to this group. Otherwise, a new group with the given name will be added to the XJRunner test list and the function will be added to the new group.