IBM Support

Configuring Rational Rhapsody TestConductor to create Unit and Integration tests with C Modules/Files

Question & Answer


Question

How do you configure IBM Rhapsody TestConductor to create Unit and Integration tests using C Modules/Files?

Cause

TestConductor uses objects to create test cases with C Classes. However, since C Modules cannot be objects, TestConductor behaves differently. Instead of using instance links between objects, we must use usage dependencies

Answer

  1. Start with a simple C project. Two files: FileB and FileC. Each with a single function that outputs a string. In this default configuration you call them from the main file to confirm everything is working correctly.





  2. Right-click on FileB and select 'Create Test Architecture'. At this point you will prompted to add the TestingProfile if you haven't already. Accept this and continue.


  3. Right-click TestContext “Tcon_FileB” and select “Create SD Testcase”, then open the newly created TestCase “SD_tc_0()”






  4. Draw a new message from the TestContext to FileB, open the message's features window and select “FuncB()” in the realization field.





  5. Save the Project. Right-click the Tcon_FileB_Architecture test package and select, in turn:
    Update TestPackage,
    Build TestPackage
    Execute TestPackage.

    You should see the test scenario window appear and run the test case. The application will run and briefly show the function output in a command prompt




    Note: The test context consists of two items; The test context & FuncB().


    This is an example of a unit test. Now you must add the other File into this context to run an integrated test.


  6. Open the "Structure_of_TCon_FileB" Test Context Diagram under Ppkg_FileB::Tcon_FileB_Architecture::Tcon_FileB.
    Drag the second file, FileC from the browser to the Test Context Diagram.
    In the same diagram, add a <<usage>> dependency from the Tcon_FileB TestContext to the new FileC element.







  7. Open the test case “SD_tc_0()” and drag FileC to this diagram also.




  8. Draw a message from the TestContext to the FileC instance on the same diagram, it's features window and set the realization field to "FuncC()".




  9. Save the Project. Right-click the Tcon_FileB_Architecture test package and select, in turn:
    Update TestPackage,
    Build TestPackage
    Execute TestPackage.

    You should see the test scenario window appear and run the test case. The application will run and briefly show the function output in a command prompt.




    Note: This time that the test context consists of three items. The test context, FuncB() and FuncC().

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.0.2","Edition":"Rational Rhapsody Developer","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21657838