Skip to the content.

Design automation scripts

The automation framework focuses on configuring scripts once and executing them many times. To achieve this in the most effective and efficient manner, automation engineers can make use of a variety of reusable tools and constructs. It is possible to automate a single use case in many different ways. It is the engineer’s level of skill, creativity and design expertise that will result extremely powerful and effective automation solutions.

The automation script

Central to any automation is the script. In a script, it is possible to define a set of actions that needs to be executed in a specific sequence. An action is the lowest level of execution that exists. It takes a set of input parameters and performs a single (set of) operation(s) generating a technical outcome. Depending on the type of operation, the framework has embedded the notion of action types. During the design of the script, the automation engineer can make use of these types to quickly create a script. The framework will help limiting the effort by focusing on required parameters only.

Examples of actions include:

Action types

Action types are the reusable building blocks of automation scripts. Each type performs a specific operations and requires a different set of input parameters.

Look at these types as building blocks. On their own, the perform a specific operation. But when put in different sequences, they will perform any set of scripted actions. They are the bricks of our automation framework.

building-blocks

Action Type Description
action.execute (Re-)execute an action that is already defined in the script
cli.executeCommand Run a Shell Command
conn.isAlive Verify if the connection can be reached
conn.setStageConnection Define a stage connection that can be used in any next step
data.compareDataset Compare two datasets
data.outputDataset Prints a dataset for logging and debugging purposes
data.setDatasetConnection Define a dataset connection that can be used in any next action
ddl.generateFromFile Generates a ddl from a framework file structure
eval.assertEquals Evaluate if two values are equal
eval.executeExpression Evaluate an expression using scripted syntax
eval.verifyMandatoryField Check if mandatory fields are filled out
eval.verifySingleField Check a single field against a specific rule
fho.createFolder Create a folder
fho.deleteFile Delete one or more files in a folder
fho.deleteFolder Delete one or more folders and all contents
fho.executeFileTransfer Transfer one or more files between locations
fho.fileExists Verify if a file exists
fho.folderExists Verify if a folder exists
fwk.dummy Dummy for adding a placeholder step
fwk.executeScript Execute another script
fwk.executeSuite Execute a test suite of multiple scripts
fwk.exitScript Exit the script execution
fwk.includeScript Include the actions of another script and execute as one script
fwk.outputMessage Prints a message for logging and debugging purposes
fwk.route Route to one or more specific actions
fwk.setEnvironment Set the environment where the next steps will be executed on
fwk.setIteration Define an interation that can be used in any next action
fwk.setParameterFile Load a parameter file as runtime variables
fwk.setParameterList Load a list of parameters as runtime variables
fwk.setParameterValue Set a parameter value as runtime variable
fwk.setRepository Define a repository that can be used in any next action
fwk.startIteration Start an iteration block for the steps
fwk.stopIteration Stop the iteration block
http.executeRequest Execute a http request
java.parseJar Parses a Java archive file
mod.soapui Run a SOAP UI test scope
script.logOutput Store an output value as part of the script results
socket.transmitMessage Execute a socket message transfer
sql.defineDataset Define a SQL dataset
sql.evaluateResult Checks if a SQL query returns a result or not
sql.executeProcedure Execute a SQL Stored Procedure
sql.executeQuery Run a SQL query
sql.executeStatement Run a SQL statement (not returning any result)
sql.setIterationVariables Retrieve iteration variables using a SQL Statement
sql.setRuntimeVariables Retrieve runtime variables using a SQL Statement
wfa.executeFilePing Wait until a File Statement returns a result or not
wfa.executeQueryPing Wait until a SQL query returns a result or not
wfa.executeWait Wait for a defined interval
wfa.getConfirmation Wait for user confirmation

An overview of the different action types can be found here.

Configure script

It is possible to configure or update the script using the script template. The template contains a script sheet that can be used for designing the automation sequence. As an automation engineer you are able to copy/paste this sheet as required. In this way, your automation scripts can be organized across and inside several templates.

Make use of Excel functionality to accelerate authoring automation scripts

Important

Using variables

Variables allow automation scripts to be designed in a generic manner where execution depends on user input or execution context. In this way, it is possible to create reusable configurations that can be executed many times without requiring additional configuration. This is a great way of multiplying the number of automation execution fast and easy.

During the design of the script configuration the use of one or more variables can be included.

More information on using variables can be found here.

Using subroutines

Subroutines are a capability to define reusable snippets of code that can be used as part of action parameter values. In that way, a similar piece of configuration needs to be defined only once and can be reused many times. It can be compared to a spreadsheet function. As a user, you need to know the function name and what it does, not how it works in the background.

There are two categories of subroutines: built-in subroutines or subroutines defined by the automation engineer. Built-in subroutines cover different types covering lookups, data generation, variable retrieval and much more. The outcome of the subroutine will be substitured in the parameter field. In this way we make access to common functions easier and more convenient.

In order to use subroutines, the syntax `` can be applied.

At the same time, all variables that are defined inside the subroutine’s argument are also replaced on runtime. In this way, the subroutine can be used in a truly reusable manner.

More information on defining and using subroutines can be foud here.