Custom building blocks can be created by selecting one or more other building blocks in a case, right-clicking and selecting “Create Custom Building Block”.
Custom building block has lot of advantages:
- First of all we can create and encapsulate the functionality we want, and make sure that we don’t recreate the same functionality over and over.
- Second the custom block helps to maintain the overview on the canvas by grouping other building blocks, and thereby limiting the number of blocks on the canvas.
- Third, you can have custom block inside custom blocks and this way build a hierarchy of blocks covering an entire application. This way an automation case will be an orchestration of functionality in the custom blocks which is much easier to administer.
There are two ways of creating Custom Building Block
- The easiest way of creating a Custom Building Block is to create the functionality in one test case and then do the following:
- Navigate to Bock section under cases and create a new block by clicking new option and start custom block with “Execution input” block and End it with “Execution output” block with the blocks required in between both blocks.
Lets take an example of Gmail Login and see how easy it is to create a custom building block:
Here is the full test case which opens Chrome browser > navigates to “http://gmail.com/” > Enter user name press next button then enter user name and press next button to login, below is the screenshot of case
Now, for the purpose of re-usability and maintainability we can create custom building block of these login steps so that we can use it in multiple test cases, below steps explains how to create custom building block.
- Select the set of building blocks you want to turn into a “Custom Building Block” by dragging your mouse over one or more building blocks.
- Press Ctrl+H or “right click” on the building block selection and select from context menu “Create Custom Building Block”. Give a meaningful name to make it easier to find and reuse the building block after that click Save.
- The selected building blocks will be converted to a Purple color “Custom Building Block”. By double clicking you can open and edit it and save it once you are finished. Please notice that “Custom Building Block” opens in new tab for editing.
- You can find your “Custom Building Block” in the tab Building Blocks; Custom.
- Entry and exit to custom building block is defined by Execution Input and output as shown above
- Execution input is entry point for custom building block
- Execution output is exit point for custom building block
- Passing and retrieving data from custom building block is also possible using “Value input” and “Value output” building blocks as shown below and there is no restriction on inbound and outbound connector ( “Value input” and “Value output” building blocks ) inside custom building block
In order to reuse the “Custom Building Block” simply drag and drop it to other test cases, or add it as a new building block to an existing case by pressing CTRL+N on the test case canvas.
- User can only share the custom building block within the project.
- If you are using custom building block Updating
For getting a better insight you can watch a video tutorial here.