General Commands
Here is the list of general commands:
Commands: | |
---|---|
wait | repeat |
migrate | include |
condition | assert |
shell |
<wait>
Description: command that pauses the passage of the scenario to perform a certain function that requires a wait. The scenario continues running in the usual way after this command.
Required parameters:
- comment
- time – integer value
Optional parameters:
- unit – seconds or milliseconds. Seconds are used as default if the unit param is not chosen
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
<wait comment="Wait for loading new page"
time="3"
unit="seconds"/>
<migrate>
Description: command to migrate dataset within your test scenario.
Required parameters:
- comment
- alias - unique name of database you want to insert dataquery
- dataset - name of file with dataset you want to migrate (file with dataset has to be stored in 'data' folder)
Optional parameters:
name - name of the database you're using. Default DB is postgres. Possible options are:
- mongodb
- mysql
- postgres
- dynamo
- oracle
- clickhouse
- redis
condition - condition according to which this test step will or won't be executed
threshold - parameter, that set maximum allowed test step execution time
<migrate comment="Migrate test dataset for MySQL DB"
alias="MYSQL_0"
name="MYSQL">
<dataset>mysql_patch.sql</dataset>
</migrate>
<condition>
Description: command to set up condition for test execution.
Required parameters:
- comment
- name - name of condition to use in further test steps
- spel - boolean expression, has to be created with Spring Expression Language (SpEL)
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
<condition comment="if amount of books in store is lower then 25"
name="DB_RESULT"
spel="{{HOT_AMOUNT}} < 25"/>
More detailed information regarding conditions you can find here.
<repeat>
Description: command that allows you to repeat any action used in the commands.
Required parameters:
- comment
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
- times - is to set the number of repeating (not used with variations)
- variations - attribute for the variations file (not used with times)
<repeat comment="Repeat 'click' action" times="5">
<web comment="Start WEB script">
<click comment="Click on 'Sign In' button" locator="login.signIn"/>
</web>
</repeat>
<repeat comment="Run variations in repeat" variations="variations_1.csv">
<web comment="Start WEB scripts">
<input comment="Input Email Address" locator="forms.email" value="{{email}}"/>
<input comment="Input Password" locator="forms.password" value="{{password}}"/>
<click comment="Click on 'Sign In' button" locator="login.signIn"/>
<wait comment="Wait for 1 second" time="1"/>
</web>
</repeat>
Inside the <repeat> command you can use such commands as:
migrate | mysql |
web | graphql |
native | mobilebrowser |
var | mongo |
http | postgres |
wait | dynamo |
include | clickhouse |
repeat | oracle |
smtp | twilio |
lambda | sendgrid |
ses | sqs |
elasticsearch | rabbit |
shell | kafka |
s3 | redis |
<include>
Description: command that allows you to run a ‘scenario inside a scenario’ (often used to bundle different scenarios).
Required parameters:
- comment
- scenario - path to the scenario you need to launch. Since all scenarios must be stored in 'scenarios' folder, in this parameter you need specify path to your scenario from 'scenario' folder
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
<include comment="Include login steps"
scenario="/includes/login/scenario.xml"/>
<assert>
Description: command to check entered data.
There are two types:
- equal - equality of two or more values is checked
- notEqual - the inequality of two or more values is checked
Required attribute for each type:
- comment
Optional attribute for each type :
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
Required p arameters according to the type:
equal
- comment
- content - values for comparison (The minimum number must be two)
- comment
notEqual
- comment
- content - values for comparison (The minimum number must be two)
- comment
<assert comment="Test for Assert with sub-commands - notEqual and equal">
<notEqual comment="Assert for check that 3 different contents is not equal">
<content>one</content>
<content>1</content>
<content>{{ONE}}</content>
</notEqual>
<equal comment="Assert for check that two contents is equal">
<content>one</content>
<content>{{one}}</content>
</equal>
</assert>
<shell>
Description: this command is a directive that instructs a command-line interpreter (shell) to perform a specific action or series of actions.
Required attribute :
- comment
- file - file with expected result for particular query
- shellFile - element provides the name of the shell script file to be executed
- shellCommand - elements list the individual shell commands that are part of the script
Optional attribute :
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
Note! - can be used only shellFile or shellCommand and both.
<shell comment="Execute a shell script" file="expected_1.json">
<shellFile>shell-1.sh</shellFile>
<shellCommand>echo "Response:"</shellCommand>
<shellCommand>echo "$response"</shellCommand>
</shell>