Creating a stub populated with data
You can create a stub based on the structure of the schema that is defined for the operation and the have the response payload populated with data.
Before you begin
- Defined a service component and an operation under a service component. See Creating a service component and Creating an operation.
- Edited the operation for the MEP settings. See Editing an operation.
- Opened the project in the Test Factory view.
About this task
You can create a stub in an operation that uses the message exchange pattern (MEP) either at the time of synchronizing resources or after you have created and bound the physical resource with the logical one in an operation.
When you create a stub you can opt to select the type and value for the objects. You can also opt to include the optional fields in the generated stub.
Procedure
- Open the HCL OneTest™ API Test Factory perspective.
-
Select any of the following options to create a stub:
- Right-click the operation where you want to create the stub, and then select .
- Click the arrow button adjoining the Create New Stubs icon on the toolbar, and then click Stub....
The Create new Stub dialog is displayed.
- Enter a name for the stub in the Name field.
-
Click OK.
The Contents Configuration dialog is displayed.
- Select the Include Optional Fields checkbox, if you want the messages in the generated tests to include all the optional fields that are present under the nodes.
- Click Finish.
Results
You have created a stub based on the structure of the schema that is defined for the operation.
What to do next
You can run the stub. See Publishing and running stubs.