Test Plan

Step name

The field "Step Name" of the ALM Test Plan is used to described your steps. It is used in both the test execution reports in STEP and in the Test Runs reports in ALM. It is therefore a good practice to use short and expressive step names

Description field

The field "Description" of the ALM Test Plan is used to specify the flow of your Test Plan. For the simplest Test Plans it is a simple sequence of keywords with key-values as parameters. More complex Test Plans make use of the STEP Controls in there.

Keywords

The STEP Keywords may be called using the following syntax:
KeywordName ParameterName1="Parameter value 1" ParameterName2="Parameter value 2" ...

Controls

The following STEP Controls can be used in an ALM Testplan

Set (Variable assignment)

The Set-Control declares a variable and assigns it a value which can then be accessed throughout the Test Plan and sub Test Plans.

Syntax: Set VariableName = "Variable Value"

If

The If-Control allows you to execute a sequence of steps only if a particular test evaluates to true.

Syntax: If groovyExpressionThatReturnsTrueOrFalse

The condition "groovyExpressionThatReturnsTrueOrFalse" which is evaluated at execution has to be formulated using Groovy

  1. REDIRECT [[1]] and should return true or false.

The If-Block has to be closed using a step End. The list of steps between the If and End steps will be only executed if the conditions returns true.

Example:

Step NameDescriptionExpected Result
Step 1If myVar == "My Value" 
Step 2Echo "Entering If sequence..." 
Step 3End 

Echo

The Echo-Control allows you to print a text during execution and can be used for debug purposes. Echo "This is a debug message"

Sleep

The Sleep-Control allows you to pause the execution of the current plan for the specified duration.

Syntax: Sleep duration unit

  • duration = an integer specifying the duration of the pause
  • unit = the unit used to specify the sleep duration. Can be ms,s,m or h

Example:

Step NameDescriptionExpected Result
Step 1Keyword1 
Step 2Sleep 10s 
Step 3Keyword 2 

For

The For-Control provides a way to iterate over a range of values. For 1 to 10

The For-Block has to be closed using a step End. The list of steps between the For and End steps will be executed x times.

Example:

Step NameDescriptionExpected Result
Step 1For 1 to 10 
Step 2Keyword1 
Step 3End 

For each

Variables

Variables that have been declared using the Set-Control or in Parameters.js can be used at different places in the test plan.

In the Keyword parameters

Variables can be used in the keyword parameters:

Step NameDescriptionExpected Result
Step 1Set myVar = "Paul" 
Step 2Keyword1 Parameter1 = "${myVar}" 
Step 3Set myVar2 = "happy" 
Step 4Keyword1 Parameter1 = "Hi, I am ${myVar} and I am ${myVar2}" 

Using the output of a keyword in following keywords

It is often needed to use the output of a keyword as input (parameter) of the following keywords. This can be achieved using the reserved statement previous

Example: Let's say that you have a keyword CreateUser that returns the output parameter "UserID". You might wan't to search for this newly created user using the UserID returned previously.

Step NameDescriptionExpected Result
Step 1Set Name = "Dupond" 
Step 2CreateUser Firstname="Paul" Name="${Name}" 
Step 3SearchUser ByID="${previous.UserID}" 

If you have to use this UserID at many places of your test plan it might be better to save its content to a variable and reuse it later:

Step NameDescriptionExpected Result
Step 1Set Name = "Dupond" 
Step 2CreateUser Firstname="Paul" Name="${Name}" 
Step 3Set UserID="${previous.UseID}" 
Step 3SearchUser ByID="${UserID}" 
Step 4UpdateUser ID="${UserID}" NewName="Dupont" 
Step 5... 

Expressions

In addition to variables and placeholders you have the possibility to use groovy expressions in the keyword parameters.
Please refer to http://groovy-lang.org for details about the groovy syntax.

Example 1: Simple Addition

Step NameDescriptionExpected Result
Step 1Set myVar1 = 1 
Step 2Set myVar2 = 2 
Step 2Keyword1 Parameter1 = "${myVar1 + myVar2}" 

This would call the Keyword1 with Parameter1 = "3"

Example 2: Date calculation

Step NameDescriptionExpected Result
Step 1Keyword1 Parameter1 = "${(new Date()+1).format('dd.MM.yyyy')}" 

This would call the Keyword1 with Parameter1 set to the date of the following day formatted as dd.MM.yyyy

Placeholders

In order to write concise and readable test cases or to hide the complexity of groovy expressions you can define so called placeholders. 

Like variable and expressions placeholders can be used in the keyword parameters or in checks.

Example:

Step NameDescriptionExpected Result
Step 1 (date)Keyword1 Parameter1 = "Today is the ${heute()}" 
Step 2 (using the current date time)Keyword1 Parameter1 = "It is currently ${jetzt()}" 
Step 3 (genereting an unique name)Keyword1 Parameter1 = "Paul Dupont${uid()}"

Available placeholders

Per default STEP Enterprise ships with a set of predefined placeholders. For historical reasons these placeholders are in german. In future releases these placeholders will be translated in english.

PlaceholderDescriptionExample
uid()Unique ID made of 5 letters aHjKn
heute()Current date formatted as dd.MM.yyyy01.02.2018
heute('dd/MM/yyyy')Current date in a custom format01/02/2018
jetzt()Current date time formatted as dd.MM.yyyy hh:mm:ss01.01.2018 10:02:30
datum('DD+1.MM.YYYY-1')Performs a date calculation

if the current date is 01.02.2018

datum('DD+1.MM.YYYY-1')

would return 02.02.2017

Custom placeholders

The placeholders are defined in the file Templates.groovy located in the classpath of the controller. You can define custom placeholders directly in this file or in a separate groovy file. 

If you define your placeholders in a separated file you have to ensure that the name of the groovy class containing your placeholders matches the property tec.expressions.scriptbaseclass in step.properties

Expected Result field

Checks

The Expected Result field can be used to express checks after a keyword execution

Syntax: keywordOutputValue operator "expectedValue"

  • keywordOutputValue = the name of the output value of the keyword to be checked
  • operator = The operator to be used to perform the check. The following operators are supported:
    • = equality check
    • ~ regular expression check
    • contains
    • beginsWith
    • endsWith
  • expectedValue the expected value

Example:

Step NameDescriptionExpected Result
Step 1Keyword1
Parameter1 = "Value1"
Parameter2 = "Value2" 
OutputParameter1 = "MyExpectedValue"
OutputParameter2 beginsWith = "MyExpected"
Tags:
Created by Exense Admin on 2018/01/30 14:27
     
Copyright © exense GmbH
v1.0