Test Log: Difference between revisions
(Created page with 'Test Log macros provide a simple means to add information from the source under test to the currently executing test case. This information is added to the test report as annotat…') |
|||
Line 15: | Line 15: | ||
| ''message'' is a pointer to a null-terminated string | | ''message'' is a pointer to a null-terminated string | ||
|- | |- | ||
| srTEST_LOG[1.. | | srTEST_LOG[1..9]_ERROR(''message'', ...) | ||
| ''message'' is a pointer to a null-terminated format string<br/> | | ''message'' is a pointer to a null-terminated format string<br/> | ||
''...'' variable list (up to | ''...'' variable list (up to 9) matching the format string | ||
|} | |} | ||
Line 26: | Line 26: | ||
| ''message'' is a pointer to a null-terminated string | | ''message'' is a pointer to a null-terminated string | ||
|- | |- | ||
| srTEST_LOG[1.. | | srTEST_LOG[1..9]_WARN(''message'', ...) | ||
| ''message'' is a pointer to a null-terminated format string<br/> | | ''message'' is a pointer to a null-terminated format string<br/> | ||
''...'' variable list (up to | ''...'' variable list (up to 9) matching the format string | ||
|} | |} | ||
Line 37: | Line 37: | ||
| ''message'' is a pointer to a null-terminated string | | ''message'' is a pointer to a null-terminated string | ||
|- | |- | ||
| srTEST_LOG[1.. | | srTEST_LOG[1..9]_INFO(''message'', ...) | ||
| ''message'' is a pointer to a null-terminated format string<br/> | | ''message'' is a pointer to a null-terminated format string<br/> | ||
''...'' variable list (up to | ''...'' variable list (up to 9) matching the format string | ||
|} | |} | ||
Revision as of 00:25, 25 February 2010
Test Log macros provide a simple means to add information from the source under test to the currently executing test case. This information is added to the test report as annotations with a level of either Error, Warning, or Info according to the macro that is used. The log messages are also captured when tracing is enabled in the STRIDE runner.
Behaviour Testing
The srTEST_LOG_xx() macro is intended to be a general instrumentation macro for capturing information in the source under test. Logs differ from test points in that they cannot be used for the basis of expectation tests - they are strictly informational. The STRIDE log messages are intended to supplement, not supplant STRIDE Test Points.
Compilation
To use these macros you should include the srtest.h header file from the STRIDE Runtime in your compilation unit. The Test Log macros are active only when STRIDE_ENABLED is #defined, therefore it is practical to place these macros in-line in production source. When STRIDE_ENABLED is not #defined, these macros evaluate to nothing.
Reference
Error Logging | |
srTEST_LOG_ERROR(message) | message is a pointer to a null-terminated string |
srTEST_LOG[1..9]_ERROR(message, ...) | message is a pointer to a null-terminated format string ... variable list (up to 9) matching the format string |
Warning Logging | |
srTEST_LOG_WARN(message) | message is a pointer to a null-terminated string |
srTEST_LOG[1..9]_WARN(message, ...) | message is a pointer to a null-terminated format string ... variable list (up to 9) matching the format string |
Info Logging | |
srTEST_LOG_INFO(message) | message is a pointer to a null-terminated string |
srTEST_LOG[1..9]_INFO(message, ...) | message is a pointer to a null-terminated format string ... variable list (up to 9) matching the format string |
- The maximum length of the message string approximately 1000 characters. If the maximum length is exceeded, the message string is truncated.
Example
srTEST_LOG_ERROR("This is an error message.");
srTEST_LOG1_WARN("This is a warning message with format string %d.", 123);
srTEST_LOG2_INFO("This is an info message with format string %s and %s.", "this", "that");