Control flow library

Edited on December 14, 2016

High-level logic controllers

In addition to the logic you've built inside your script (at keyword level), STEP offers a wide range of logic controllers which can be incorporated to a test plan or composite keyword, thus decoupling the test or business logic from the atomic actions implemented as keywords.

Supported logic controllers

You will find below a description of what each controller does and of its primary properties. Advanced usage will be documented later on. We sometimes refer to them as "control flow structures" or just "controls".

  • Sequence

    • Primary use : simply guarantees the ordering of the child nodes, as displayed in the tree

    • Primary properties : none

    • Example : simply wrap the child nodes with a Sequence node

  • For

    • Primary use : creates a For loop at execution time and iterates through the child nodes

    • Primary properties : item (key of the data accessor), parallel (true/false), threads (number of threads if //), start (initial value), end (final value), inc (increment value)

    • Example : item=datapool; parallel=true; threads=10; start=1; end=5; inc=1

  • ForEach

    • Primary use : creates a ForEach loop based on a collection and iterates through the child nodes

    • Primary properties :item (key of the data accessor), parallel (true/false), threads (number of threads if //), table (Excel File or SQL Query), folder (JDBC URL)

    • Example 1 : item=datapool; parallel=true; threads=10; table=D:\ExcelDatapool.xlsx

    • Example 2 :  item=datapool; parallel=true; threads=10; table=select FRUIT_NAME, FRUIT_ID from MYFRUITS; folder=jdbc:mysql://localhost/SID,USER,PASSWORD,com.mysql.jdbc.Driver
      (also tested with Oracle ojdbc6.jar)
      IMPORTANT: You need to copy your driver library (jar file) in the lib folder of the agent to use JDBC functionality.

  • FunctionGroup

    • Primary use : guarantees that the same driver session will be used for every child node's execution (very important for stateful keywords which rely on a certain driver state as an initial condition)

    • Primary properties : selectionCriteria (optional, for affinity patterns)

    • Example : leave empty

  • If

    • Primary use : only executes the child nodes if the condition is met

    • Primary properties : condition (the expression evaluated to know if the content of the node is executed)

    • Example :condition=my_variable == true

  • Return

    • Primary use : delivers a value back to the parent node

    • Primary properties : value

    • Example : value=3

  • Check

    • Primary use : asserts the input expression, useful for validating the output of the parent node

    • Primary properties : expression (the expression to be asserted)

    • Example : expression=output.getString("output1")=="val1"

  • Case

    • Primary use : same as in any programing language, works in combination with switch

    • Primary properties : value (the value to be potentially matched)

    • Example : value=4

  • Switch

    • Primary use : same as in any programing language, works in combination with case

    • Primary properties :expression

    • Example : expression=my_switch_variable

  • Set

    • Primary use : sets a value to a variable, which can then be accessed throughout the Test Plan and sub Test Plans. Combined with the power of groovy, litterally anything can be achieved in a Set node.

    • Primary properties : key (the name of the variable where STEP will write), expression (the groovy expression to be interpreted, it can litterally be anything)

    • Example 1 : key=my_connection; expression=groovy.sql.Sql.newInstance('jdbc:mysql://localhost/SID', 'USER', 'PASSWORD', 'com.mysql.jdbc.Driver')

    • Example 2 :key=my_result; expression=my_connection.rows('select fruit_name, fruit_id from MYFRUITS where fruit_id = 1')

​​You can then pass the value of my_result as a keyword input in the "argument" box:
{ "input1" : "[[my_result.fruit_name.first()]]" }
The double brackets will evaluate the content as a groovy expression even though the expression is located inside a json string.

 

  • FunctionCall

    • Primary use : makes a call to a given function, generally a keyword

    • Primary properties : function (json with a key "name" to call an annotated method through reflexion), argument (arguments to be fed through @Arg annotations), token (if a specific token is expected to be used for that call), resultMap (a handle on the resulting data)

    • Example : <not_yet_documented>

  • RetryIfFails

    • Primary use : retry mechanism with grace period

    • Primary properties : maxRetries (number of retries if step fails), gracePeriod (duration to wait in ms after a failed attempt)

    • Example : maxRetries=2; gracePeriod=1000

  • TestSet

    • Primary use : used to group up TestCase's  as a single unit and executing them in parallel

    • Primary properties : none

    • Example : simply wrap your TestCase's with a TestSet controller, parallelisme is derived from the global variable "tec.execution.threads"

  • TestCase

    • Primary use : specific typing of a Test Plan, will activate the top-level panel in the execution view to high-level test case execution monitoring

    • Primary properties : none

    • Example : simple wrap your Test Plans with a test case

  • TestScenario

    • Primary use : - DEPRECATED - grouping of test plans as a single load test execution unit

    • Primary properties : none

    • Example : simply wrap your TestGroup's and execute

  • TestGroup

    • Primary use : - DEPRECATED - introduces pacing and rampup properties for load test groups, pacing and rampup will be made available in the For and ForEach controllers to reduce the number of controllers

    • Primary properties :

    • Example :

logicalControllers2.png