What can we help you with?
Snippet
What is a Snippet?
- A small piece of code is known as Snippet.
- It is a pre-defined method.
Why do we need Snippets?
- Snippets can help users to create prerequisites and assert scripts.
- The created snippet will go and sit as a link beside the code editor of the pre-requisite and assert tab.
- When the user clicks on the snippet, the method will come and sit in the code editor.
- There are default snippets available in the Snippet List table. The user can create their snippet by clicking on the “+ Snippet” button.
Navigation to Snippet tab:
- Click on the web service dropdown.
- Select a snippet and the user will be navigated to the snippet list page.
Creating a Snippet
- Click on the “+ Snippet” button to create a snippet, which will be navigated to the Create snippet page.
- Users will land on the “Create Snippet” page.
- Enter the name in the snippet description text field and enter the code in the code editor.
- The user can make use of the snippets provided beside the snippet menu.
- After writing the code, click on the “Compile & Save” button. Upon clicking on it, it will compile the code and if there are no compilation errors then it is created and will be displayed in the Snippet list table.
- If there are any compilation errors, it is displayed in the Console section, wherein the user needs to rectify the errors to create a snippet.
- If the user does not want to create a snippet, then you can click on the Back button which will navigate the user to the Snippet List table.
Note: The user cannot create the snippet with the same Snippet Description that is available in the Snippet List table.
Edit a Snippet
- Users cannot edit a default snippet so the “Edit” icon is disabled for it.
- Upon mouse hovering on any row, the edit icon is displayed. When clicked on which, the user can navigate to the Edit Snippet page.
- Here, all the details of the particular snippet are prefilled and the user can make the necessary changes and click on the “Compile & Save” button.
- Upon clicking on the “Compile & Save” button, if there is no compilation error, it will get updated in the Snippet List table.
- If there are any compilation errors, it is displayed in the Console section, wherein the user needs to resolve the issue to update that snippet.
- If the user does not want to update that snippet, then you can click on the Back button that will navigate you to the Snippet List table.
Note: The user cannot update the snippet with the same Snippet Description that is available in the Snippet List table.
Delete a Snippet
- When hovering by mouse on any row, the “Delete” icon is displayed.
- Upon clicking on it, a Warning popup is prompted.
- If the user confirms by clicking the “Delete” button, then the snippet is successfully deleted from the Snippet List table and the user will get a success banner.
- If the user does not want to delete that snippet, then you can click on the Cancel button which will close the popup.
- Users cannot Delete default snippets and the ‘Delete’ icon is disabled.