Asterisk - The Open Source Telephony Project
18.5.0
|
Create a callback function for the test using the AST_TEST_DEFINE macro.
Each defined test has three arguments available to it's test code.
struct | ast_test_info *info |
enum | ast_test_command cmd |
struct | ast_test *test |
While these arguments are not visible they are passed to every test function defined using the AST_TEST_DEFINE macro.
Below is an example of how to define and write a test function.
Details of the test execution, especially failure details, should be provided by using the ast_test_status_update() function.
Register the test using the AST_TEST_REGISTER macro.
AST_TEST_REGISTER uses the callback function to retrieve all the information pertaining to a test, so the callback function is the only argument required for registering a test.
AST_TEST_REGISTER(sample_test_cb); \ Test callback function defined by AST_TEST_DEFINE
Tests are unregestered by using the AST_TEST_UNREGISTER macro.
AST_TEST_UNREGISTER(sample_test_cb); \ Remove a registered test by callback function
Execute and generate test results via CLI commands
CLI Examples: