Skip to content
/ .. /
Introduction





5. Steps & Compound Steps

Steps and Compound Steps are used in Feature File Scenarios to define events and expected outcomes. Steps block execution, waiting for their results, as opposed to Compound Steps, which stage an action that is performed in the background, allowing subsequent Steps within the Scenario to be executed concurrent to the Compound Step.

For general information about creating Feature Files, refer to Feature Files in the General Concepts chapter.

Steps and Compound Steps
Steps
Feature File Example with Steps
Given, When, Then & And
Timed and Deferred Steps
Compound Steps
Feature File Example With Compound Steps
Compound Steps Configuration
Incompatible Step Details

Steps

Each Step carries out an action and blocks further test case execution until it either passes or fails. Steps must start with one of the keywords Given, When, Then, And or But.

Feature File Example with Steps

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Feature: SMS
  Scenario Outline: SMS_originatingBasicSMS
    Given an Android phone as A
      And an Android phone as B
    When A composes a short message
      And A types "Hello, world"
      And within 30 seconds, A sends the short message to <receivingParty>
    Then within <dur> seconds, B receives a short message from A.number as sms
    Then verify sms.text == "Hello, world"
    Then verify sms.text.length() == 12
  Examples:
    | dur | receivingParty |
    | 120 | B.int00      |
    | 60  | B.local      |

Given, When, Then & And

Note: The following guidelines are recommendations. However, a test case will not fail because of a different usage of these Cucumber keywords.

Given

Given is used for preconditions and input parameters such as phones/browser, balances, subscriptions and call forwarding.

Example

1
Given an Android as phone A

When

When is used for initializing an action or event, for example, sending a SMS.

Example

1
When A composes a short message

Then

Then checks for the successful execution of the test case and verifies the expected results.

Example

1
Then verify sms.text == "Hello, world"

And

And uses Steps within a Given, When or Then section.

Example

1
2
Given an Android phone as A
And an Android phone as B

Timed and Deferred Steps

The timed element is indicated by applying after to a command or element. The timed and deferred elements can be used for a selection of Steps.

Example

1
And after 10 seconds, A answers the incoming call

Although deferred Steps can be placed anywhere in a scenario, and not necessarily at the end, they will be executed after all other Steps have finished. If multiple deferred Steps exist in a scenario, they will be executed in the reverse order from the one they have been defined in.

Example

1
2
3
And deferred, B sends the following ussd removeCallForwarding

And deferred, within 30 seconds, A disables data connections

Note: It is recommended not to enable deferred data connections. This may result in the data connection staying active, resulting in used up data volume and/or high charges.

Compound Steps

Compound Steps are parametrized Steps that perform an action in the background. They can be activated or deactivated in the Glue Configuration. The parameters, such as phone characteristics, certain conditions and timeouts are passed in the Compound Step's Step Details.

Note:

  • Each Step Detail is nested beneath the Compound Step and indicated by an asterisk (*).

  • A Compound Step with Step Details must have a colon (:) at the end.

  • Compound Steps without Step Details must omit the colon.

  • All actions in the test script that refer to the Compound Step are referenced by a variable assigned to the main event (for example myCall or mySMS.)

  • The phone acquisition Step is not executed in the background and there is no expect Step to verify its result. If intaQt cannot acquire the specified phone, the Step will fail.

Feature File Example With Compound Steps

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Feature: callCompoundStep
  Scenario: callCompoundStepScenario
    Given a phone as A:
      * of type Android
      * where operator == "3 AT"
      * with profile Vienna

    Given a phone as B:
      * of type Android
      * where IMEI == "351554019631511"

    And A starts a call to B as MYCALL:
      * detect incoming call within 10 seconds
      ...

Compound Steps Configuration

Compound Steps Configuration

intaQt's built-in Compound Steps are activated by default. These can be replaced by a Custom Implementation written in the Steps when default Steps are deactivated in the Glue configuration.

Additional information is available in the Glue Configuration section.

Syntax

1
2
3
4
5
6
Glue = {

    path : [<String>, ...]
    builtinTelephonySteps : <String>

}

Parameters

  • path - Points to the path where the custom Compound Steps are located

  • builtinTelephonySteps - Whether intaQt's built-in Compound Steps are available or not

  • Must be one of "activated" or "deactivated"

Example

1
2
3
4
Glue = {
    path : ["/home/user/QiTASC/intact/customsteps"]
    builtinTelephonySteps : "activated"
}