Test case structure

The main objective of a test case is to define the variable checks that will compare the values obtained during the run with the expected values defined in the test case.
During the run, the test case performs a call to the C function using a set of initialization expressions and compares the return values with expected value expression. Each variable check is defined by:
  • The name of the variable in the function.
  • An initial expression: this is the expression of a value, or a set of values, that is submitted to the function during the test. You can express multiple initialization values, which causes multiple iterations of calls to the function under test.
  • An expected expression: this is the expression of a value, or a set of values, that is compared to the actual value obtained during the test. Compliance with the expected expression produces either a failed or passed verdict for the test.

Activity diagram

The Activity diagram displays a flow chart describing the blocks that are required in the test case. If necessary, you can add and remove blocks, conditions and arrow lines to edit the activity diagram. The test case criteria are contained in one or several Check blocks.

The graphical flow chart allows you to add decision blocks and native C code to the test. For example, you can use decision blocks to run specific checks when a variable matches a specific value, or you can write a code block to define a counter and associate it with a decision block to create a loop.

Initialization and stubs

The Init & Stubs block summarizes the initialization values from all the check blocks and stub behaviors in the test case.

Code

By default, the Code block contains code that performs the call to the function under test.

The code block enables you to add native code to a test. This can be useful to run a specific portion of code in the middle of a test case. For example, you can change a hardware configuration before running a test or between two check blocks that verify the same function.

You can also write a code block to define a counter and associate it with a decision block to create a loop.

Variable checks

The main objective of editing a test case is to define the variable and structure checks. This is done in the Checks block by using the Variable checks table.

Feedback