Skip to content
QiTASC.com / General Concepts / Feature Files /
Annotations and Metadata
/ .. / .. /
Annotations and Metadata





Annotations and Metadata in Feature Files

intaQt supports the use of annotations and metadata in its Feature Files.

The following built-in annotations may be used to:

  • Specify functionality such as repeat and interpolation mechanisms

  • Attach additional metadata to reports

Annotations

Annotation - Repeat Execution a Specified Number of Times

Adding the @Repeat annotation at the top of a Feature File enables intaQt to execute a Feature multiple times. This can be useful, for example, when a test execution depends on the randomly-generated numbers and can produce different results.

Syntax

1
2
3
@Repeat(<times Number>)
Feature: <featureName Text>
    ...

Parameter

  • times - The number of times the Feature must be executed
    • Must be a positive number or 0

Example

1
2
3
4
@Repeat(5)
Feature: Simple repeat
  Scenario: Simple scenario
    And verify 1 == 1

Note: If the annotation is specified more than once in a Feature File, the feature execution will fail.

Annotation - Interpolates Variables from Configuration

Expressions wrapped around @@ markers will be statically evaluated before Feature File execution and replaced with the actual value that comes out of the evaluation. The Vocable Language syntax is supported, using Context Objects as scope for the evaluation.

Example Feature File - Using the Same Feature File with Multiple Phones In the example below, the Feature File includes an expression, phoneType wrapped with @@ markers. intaQt will pre-process the Feature File prior to its execution and evaluate and replace all @@phoneType@@ occurrences with the value assigned to the phoneType Context Object.

The actually Feature File will look as follows:

1
2
3
4
5
Feature: Testing with @@phoneType@@ phone

    Scenario: Acquire an @@phoneType@@ phone

        Given an @@phoneType@@ phone as A

Example Configuration The example above would access a Context Object called phoneType:

1
2
3
ContextObjects {
    phoneType: "Android"
}

Example Execution Based on the Feature File and Configuration examples above, the actual steps executed from the Feature File will look as follows:

1
2
3
4
5
Feature: Testing with Android phone

    Scenario: Acquire an Android phone

        Given an Android phone as A

Metadata Annotations

Metadata for Step/Scenario/Feature inside Feature Files

Metadata annotations at the Feature, Scenario and Step levels inside a Feature File are processed and attached to the report data model.

Syntax

1
#@<Metadata Name>: <Metadata Value>

Parameters

  • Metadata Name - The name of the metadata

  • Metadata Value - The value of the metadata

    • The value is treated like a vocable language string, with string interpolation support
    • All groups in the form of ${...} will be evaluated against the current Scenario execution context

Note: intaQt will ignore any metadata that it fails to process (for example, wrong syntax or unresolved references in the execution context).

Example

1
2
3
4
# Verification
   #@ Test Data : ${REQ}
   #@ Expected Result : Assertions PASSED, ResponseDetails is OK, ${RESP}
   And check billing tax code id taxCodeId has name "BilTaxNameIntact" taxrate 20 taxRateRelation 100 and is default false

Metadata inside Scenario Outline Examples

Metadata annotations in the Examples section of a Feature File with Scenario Outline are written above the Example row. The metadata are processed and attached to the report data model. Multiple metadata usages may be used within an Examples section.

Syntax

1
2
#@<Metadata Name>: <Metadata Value>
<example Example>

Parameters

  • Metadata Name - The name of the metadata

  • Metadata Value - The value of the metadata

    • The value is treated like a vocable language string, with string interpolation support
    • All groups in the form of ${...} will be evaluated against the current Scenario execution context
  • example - The Scenario Outline's Examples

Example

1
2
3
4
5
6
7
8
examples:
bundlename     |bundlecode

#@ ScenarioName: activate bundle prepaid for subscriber
prepaid        |102

#@ ScenarioName: activate bundle postpaid for subscriber
postpaid       |203