Test Function List Sample: Difference between revisions
Line 9: | Line 9: | ||
==== basic_simple ==== | ==== basic_simple ==== | ||
This example demonstrates passing and failing tests using the primary integer types that infer status from. | This example demonstrates passing and failing tests using the primary integer (int, short, and char) types that infer status from. | ||
==== basic_fixtures ==== | ==== basic_fixtures ==== |
Revision as of 00:32, 1 October 2009
Introduction
Function Lists are abbreviated as flist in both pragmas (as in scl_test_flist) and documentation. The Test flist Samples pertain to test units that contain lists of functions to be executed. The Test FList functionality is intended as a simple grouping of test functions and are designed to be used with the C language (although it is not restricted from compilation in a C++ environment as well). Test FLists does not support more advanced usages patterns like private test data. If you need more advanced functionality, consider using Test Classes (C++) or Test C-Classes.
Tests Description
Basic
These examples cover the simplest, easiest way to code STRIDE scl_test_flist functionality. These examples use simple POD return types to indicate status and do not annotate the tests with any rich information (such as comments).
basic_simple
This example demonstrates passing and failing tests using the primary integer (int, short, and char) types that infer status from.
basic_fixtures
This example shows how to use setup and teardown fixtures. The setup and teardown methods are called immediately before and after the execution of each test method, respectively.
Runtime Services
These examples cover basic usage of our Runtime Test Services API (as declared in srtest.h).
runtimeservices_simple
This example shows how to use srTestCaseSetStatus to set status, srTestCaseAddComment to add a comment, and srTEST_ADD_COMMENT_WITH_LOCATION to add a comment that automatically includes line and file information.
runtimeservices_dynamic
This example shows how to use srTestSuiteAddSuite, srTestSuiteAddCase, srTestSuiteAddAnnotation, and srTestAnnotationAddComment for dynamic suite, test, and annotation creation in the context of a single test method.
runtimeservices_override
This example shows how to use srTestCaseSetStatus to override the status that would otherwise be inferred from the return value.
runtimeservices_varcomment
This example demonstrates the use of printf style format strings with srTestCaseAddComment.