Creating an C++ Component Test
Since you will be testing C++ code, the first order of business is to reselect the C++ TDP- based Configuration. Once done, you will follow virtually the same steps as you took for creation of a component testing test script for C and Ada. The difference? Accommodating the IBM® DevOps Test Embedded (Test Embedded) ability to implement assertion tests.
To create a C++ Component Testing test node
- Select the menu item Window->Close All(and close the Output Window at the bottom of the UI if you wish to free up additional space).
- In the toolbar dropdown list for Configurations, select the C++ TDP configuration you used in the Runtime Analysis exercises, thereby replacing the currently selected C TDP-based Configuration.
- On the toolbar, click the Start Page
button. - Select the Activities link on the left side of the Start Page.
- Select the Component Testing link in the center of the Start Page.
- In the window Application Files -Notice how all C++ source and header files of your project are already visible . No changes need to be made, so simply click the Next button.
- In the window Components Under Test, select the checkbox next to the reference to the PhoneNumber class. (Since a single C++ class can be defined in multiple files, classes are listed by the Wizard rather than any implementation reference. This also explains why the file in which a class is declared is listed in the File Name column - there is only one declaration, while definitions can occur across multiple files.) Click the Next button.
- In the Test Name field, enter the name PhoneNumber. Leave the default values and click the Next button.
- You should now be viewing the Summary window. Click the Next button.
The component testing wizard now analyzes the source code in PhoneNumber.cpp and PhoneNumber.h and creates a test for every class defined in the .cpp file.
- Click the Finish button.
- Select the menu item File->Save Project.
Note: In the Project Browser tab, a C++ component testing node named
PhoneNumber has been added to your project.