How can I create a greybox test architecture with multiple SUT classes?

Sample model: Samples/CSamples/TestConductor/TestingCookbook/MultipleSUTClasses

The test architectures created by TestConductor are tailored for unit testing of a single class (object, file, block). If the integration of multiple classes should be tested and the communication between the SUT instances should be observed, a greybox architecture can be created and adjusted to contain multiple SUT instances of different classes. The sample shows an example how to do this.

To automate the creation of replacements (test components replacing design classes), two helpers are available:
  • 'Create Greybox SUT' helper to create a TestSUT and further needed artifacts (instance, dependencies,..)
  • 'Create Replacement TestComponent' helper to create a replacement test component and further needed artifacts (instance, dependencies,..)
These helpers are invisible by default. To make them visible you have to search the helper entry in the rhapsody.ini and set isVisible=1.

Screen capture

In the sample, classes A and B should be the SUT classes. First, create a greybox test architecture for class A. To do this, Tools -> TestConductor -> CreateTestArchitecture Transparency must be set to GreyBox. Then remove the test component B and the test component instance itsB. This test component/test component instance is not needed because B should be a SUT class.

Screen capture

Now the 'Create Greybox SUT' helper can be used. Set the component of the test package as active as the helper will add the replacement to the test package of the currently active component. Then select class B which has a bidirectional association to the existing SUT class A and run the 'Create Greybox SUT' helper. A TestSUT B as well as a SUT instance itsB are added to the test architecture. Add the SUT instance itsB to the test context diagram and connect the SUT instances itsA and itsB.

Screen capture

In the next step update the test architecure by selecting the 'Update TestArchitecture' helper on the test context. A test component D as well as a SUT instance itsD are added to the test architecture. Alternatively you could also use the 'Create Replacement TestComponent' helper for this. Now the scope of the component of the test package must be updated accordingly by deselecting class D from the Default package.

Screen capture

Finally you can create and execute test cases. TPkg_A shows such a test architecture with a SD test case.