How can I set or check attribute values in sequence diagram test cases?

Sample model: Samples/CppSamples/TestConductor/TestingCookbook/CppCompositeCoffeeMachine_SDexp

If you want to set or check attribute values in sequence diagram test cases, you can select test assignments and test conditions from the drawing toolbar. Test assignments are used to assign values to attributes and are applicable to SUT and test component instance lines. Test conditions are used to check values of attributes and are only applicable to SUT instance lines. This sample model includes several test cases using test assignments and test conditions.

Screen capture

Class Coffeemachine which should be tested has several parts having attributes. Within the test cases, these attributes should be set to specific values and their values should be checked.

Screen capture

During test case update, a driver operation is generated for each test assignment as well as for each test condition. The following picture shows the driver operations which are generated if you for example update test case SD_tc_refill in test package TPkg_Coffeemachine_GB.

Screen capture

Note that in test conditions it is also possible to check whether a statemachine is in a specific state using the IS_IN macro.

Screen capture