In CT, if there are no libraries used in the target function when executing a test, if the libraries are not yet developed, or if the variables not declared are used, it creates automatically the stubs instead. The stubs are created when running the test and the body is not implemented.
You can add stubs directly in addition to the stubs created in CT. Multiple stubs can be created for the same function and the stubs created can be linked to each test.
You can control the behavior of each stub by using user macro within the stub. The value used in the user-entered macro can be controlled in Edit a test case tab for the test linked.
Function type
Type | Description |
---|---|
|
Function without deficition |
|
Function with definition |
|
Global variable |
Stub type
Type | Description |
---|---|
|
User-defined stub |
|
Auto-created stub |
|
Stub with 2.3 or less version |
Menu
Create stubs
- Create stubs in Stub view
- Create stubs in source code editor
- Create and Link in Test Editor
Delete stubs
Edit stubs
- You can check the macro information by pressing ‘Ctrl + Space’ in the Stub Code screen. After editing the stub code, press ‘Ctrl + S’ or [Save] button in the toolbar to save it.
Link between stubs and tests
Each stub can be linked to the host/target test.
If you select “Stub” in the test structure editor, you can edit all the stubs included in the host and the target.
If you select “Host” or “Target”, you can only edit the stubs in the selected test environment.
- Link with [Add Stub…] button in Test Editor.
Unlink between stubs and tests
Select the stubs linked in the Test editor and select [Remove Stub] button or select the stubs in the test structure tree and right-click it to unlink them.
Export stubs
Import stubs
Use/Not use stubs
You can set whether to use the created stubs.
Need more help with this?
Don’t hesitate to contact us here.