What’s a Keyword?
Conceptually speaking, Keywords can be seen as the reflection of a piece of business logic which a human (or a process) would otherwise perform. At the technical level, a Keyword is represented by a code package or “script”, which performs a specific action against a target system. Upon execution, information can be passed to the Keyword dynamically as an input, as well as extracted from the subject of the automation and returned as an output. You can find out more about Keywords in the dedicated section of our documentation.
When using and leveraging the Keyword API at industrial scale, many benefits arise from using Keywords as a building block, such as out-of-the-box scalability via the distribution of Keyword executions, execution traceability, reporting and a strong basis to base and organize automation code upon.
First, click the Keywords tab in step’s web application, and then click the New Keyword button.
A basic script template is provided at creation time, which we’ll use as a basis for our new Keyword. What this template does by default is nothing more than returning any inputs back as an output. In our Keyword, we will simply create an arbitrary variable to store the current date and return it as an output.
Let’s add the following line of code to assign the current date to a variable called myDate.
And modify the last line of the script template to return our new dynamic value in the JSON output of the Keyword call:
Let’s create a plan in order to execute our Keyword.
What’s a plan?
Plans are the implementation of an automation scenario and can be designed using different formats but in this example, we will use step’s visual editor by default. They are structured as a tree of nodes which will be executed sequentially by default.
As explained in detail in the dedicated section of the documentation, Plans can represent any sort of automation asset, ranging from a test case, to a load scenario, an RPA routine, or even a monitoring probe. They usually combine the execution of Keywords with various control structures. Once a Plan has started, execution ensues and Keywords are distributed on the available agents.
Let’s now click the Plans tab and create a new plan by clicking on the New plan button.
Let’s name our plan and click the Save and edit button, which will take us to the plan editor.
We’ll search for our newly created Keyword in the Keyword library on the right side of the screen and add it to our plan.
An instance of the Keyword’s call should now appear in your plan’s tree.
Let’s now execute our plan by clicking the play icon in the top right and then the play icon that opened.
As you can see, the corresponding script was executed, and the current date is provided as an output.
We now encourage you to move on to a more complex scenario such as Selenium-based browser automation, and also to take a look at our plan library and the rest of our documentation pages to get a better sense of all the possibilities offered by Keywords and Plans.