The Learn More tab in the Mock Service feature makes it easy to create your first Mock Service.
Additional options are available when you create a Mock Service from the Mock Services page. See Creating a Mock Service for more information.
- Click the Mock Services tab.
- Click Learn More at the top of the page.
- Drag your Swagger or HAR file into the upload area, or click the area to browse and find the file you want. This file should contain all of the Transactions that you want to use for your Mock Service.
Note: If you want to upload multiple Swagger files using a zip file, the main file in the zip file must be named index.json or index.yaml for the upload to work.
If you do not have a file, you can try the sample file by clicking the link below the upload box.
The Mock Services page opens, and the first Mock Service listed was newly generated from the file you uploaded.
- Click the arrow next to the Mock Service name to expand the details for the mock service.
- Enter a name for the Mock Service in the Mock Service Name field.
- This field is populated with a default name that you can rename to any Mock Service name that you like.
- Leave the default selection in the Select Service drop-down.
A Mock Service created from Learn More automatically creates a Service for you. For more information about Services and how you create them in a typical scenario, see Creating a Mock Service.
- Select the location that you want to deploy your mock service to from the Location drop-down.
- Unless you plan to run the Mock Service in a private location, select Cloud Provider > Cloud.
- Select either HTTPS or HTTP from the Endpoint drop-down.
- The default is HTTPS.
- Review the Transactions in this Mock Service pane to see the Transactions added to the Mock Service from the file you uploaded.
Creating a Mock Service from Learn More automatically adds all Transactions from your file to the Mock Service. You can remove Transactions as needed by moving them to the left pane.
- Click the Parameters tab.
- In the No Matching Requests field, choose the correct logic for when a request against the Mock Services does not match any of the provided transactions. The request can either throw an error or be redirected to the live service.
- Set the Think Time in milliseconds to control the amount of time spent between when the Mock Service receives and request and when it sends a response.
- Click Save.
The Mock Service is created and available on the Mock Services page. Run the service to activate the virtual endpoint and run tests against it.