10
@TestHomeValidation
Feature:copy function test

  Background:
    Given I am running test in "VARIABLE" environment

Can I use VARIABLE in above background given statement? I want to pass this VARIABLE value from properties file.

Eugene S
  • 6,709
  • 8
  • 57
  • 91
Manoj Mali
  • 111
  • 1
  • 1
  • 6

3 Answers3

3

You can achieve this with QAF gherkin client.

@TestHomeValidation
Feature:copy function test

  Background:
    Given I am running test in "${my.env}" environment

Provide your my.env in property file. Further more you can have environment specific resources that you can configure with QAF

user861594
  • 5,733
  • 3
  • 29
  • 45
1

I afraid you want be able to use external data source for storing variables to provide to Cucumber steps. What you might consider us using DataTables Scenario Outlines. In both cases you can provide some local(intra-feature file) parameters. For example:

Scenario: Scenario1 
  Given I have done "this" #this can be parsed by the glue code
  Then these can be used: #You can use DataTable type to parse multiple groups of variables
    | col1 | col2 | col3 |
    | x    | x1   | x2   |
    | y    | y1   | y2   |


Scenario Outline: <col1> test 
  Given I have done "<col2>"
  Then I can see "<col3>"
    | col1 | col2 | col3 |
    | par1 | par2 | par3 |
Eugene S
  • 6,709
  • 8
  • 57
  • 91
1

Like @eugene-s mentioned this is not possible out of the box.

I have a similar case where I need to substitute and possible add more variables from external file.

The solution we going for is to parse the features with Gherkin parser, put in the values and create new tree which can be either written to a new file and passed along or substituted directly in the test runner.

if interested you can follow the development here

kalin
  • 3,546
  • 2
  • 25
  • 31