You can find usage of the commands below in:
List of commands:
- BYTES
- CONCAT
- CURRENT_DATE
- DATE_PARSE
- EMPTY_STRING
- FILE
- FORMAT_DATE
- LOWER_CASE
- MAP
- NEXT_CALENDAR_DATE
- NIL
- NULL
- PLUS
- RANDOM_DATE
- RANDOM_EMAIL
- RANDOM_NUMBER
- RANDOM_NUMBER_IN_RANGE
- RANDOM_STRING
- RESOURCE
- SUBSTR
- TEST_CONTEXT_COPY
- UNESCAPE
- UPPER_CASE
Provides byte array for string in SOAP or REST requests.
- param - string
- result - reference in meaning TestContext to byte array
This command simply concatenates the arguments it is supplied with. It can concatenate two and more arguments and the arguments can be commands as well.
Examples:
{CONCAT:1:2:3:4:5} {CONCAT:12:{CONCAT:3:4:5}}
Both examples above produce the result
12345
Current date command returns text form of current date.
The CurrentDateCommand can be used in JBehave's tables in three ways:
{CURRENT_DATE}
without parameter, is evaluated to the current date{CURRENT_DATE:<number>}
with numeric parameter, is evaluated to the current date shifted about given number of days{CURRENT_DATE:<period>}
with period parameter, is evaluated to the current day shifted about given period of time, see {@link Period#parse}
Command for parsing date. Command consumes two arguments:
- date in string format
- format.
Example:
{DATE_PARSE:05/20/2031:MM/dd/yyyy}
This command produces empty string.
Examples:
{EMPTY_STRING} {EMPTY}
Provides canonical path to file. Command consumes two parameters:
- the resource location, e.g. org/jbehavesupport/core/expression/FileCommandTest.class
- optional name of file
Example:
{FILE:image.png}
Format date to expected format. Command consumes two arguments:
- date in string format
- output format
Example:
{FORMAT_DATE:2031-05-20:MM/dd/yyyy
This command takes one parameter that gets converted to lower case.
Example:
{LOWER_CASE:FOO} {LC:Foo}
Both the examples above produce the result
foo
Maps the first argument according to the mapping supplied in the second argument. It can be used when the value passed in a SOAP message is shown in the UI differently. True might be displayed as Yes. Mapping must be supplied as a comma delimited list of comma delimited tuples in brackets [ ].
Example:
{MAP:0:[0,Zero],[1,One],[Unknown]}
Produces result
Zero
Command consumes one parameter as day. If the day is higher or equal to day from TimeFacade
current month is used. If the day is lower than day from TimeFacade
we will reset day to 1 and set month to next month.
Example:
{NEXT_CALENDAR_DATE:2}
If today is
10.3.2018
the result will be12.3.2018
Dedicated to send nil=true in SOAP request for JAXBElement.
Example:
[$request] data for [$application]: | name | data | | Foo.validTo | {NIL} |
This command takes no parameters.
Example:
{NULL}
This command simply do the sum of parameters.
Example:
{PLUS:2:2:3}
Result of the command:
7
Command generate random date in range 1970 - 2059.
Example:
{RANDOM_DATE}
Result of the command:
LocalDate object
Creates a valid random email according with fixed length.
Example:
{RANDOM_EMAIL}
Result of the command:
xslk@wkle.com
Generate random numeric string with specific length. Command consumes one parameter:
- length of random number.
Example:
{RANDOM_NUMBER:3}
Result of the command:
957
Generate random number in range.
Example:
{RANDOM_NUMBER_IN_RANGE:3:5}
Result of the command:
9576
Generate random string with specific length. Command consumes one parameter which specified random string length.
Example:
{RANDOM_STRING:2}
Result of the command:
aD
Provides byte array for sending files in SOAP or REST requests.
- param - string path to resource
- result - reference in meaning TestContext to Resource
Example:
{RESOURCE:image.png}
Result of the command:
Resource object
Returns a string that is a substring of the first parameter. The substring begins at the index specified by second parameter and extends to the character at index - 1 specified by the third parameter (or end of string if the optional third parameter is missing).
Example:
{SUBSTR:unhappy:2}
Result of the command:
happy
Get value from test context. Short hand CP
. Command consumes two parameters:
- key in test context
- optional - prefix which will be added to result
Example:
{CP:FIRST_NAME}
Result of the command will be data from test context.
Unescapes any java literals found in string, useful for sending special characters like whitespaces.
Example:
{UNESCAPE:\t} {UNESCAPE:FirstLine\nSecondLine}
Result of first command is tab. Second command will produce:
FirstLine SecondLine
This command takes one parameter that gets converted to upper case.
Examples:
{UPPER_CASE:foo} {UC:Foo}
Both the examples above produce the result
FOO