'Pass a variable from command line into scenario or feature in feature file

Currently I have Behave tests that run in Selenium but pick which browser to test based on an Environment Variable. Is there any way to pass text from the command line to a .feature file?

Something like:

DRIVER=chrome behave /path/to/features -i test -D browser=chrome

And then in the test.feature file be able to do something like this:

Feature: Testing something in "{browser}"

  @browser
  Scenario: Something can do something in "{browser}"
    Given I am on "index"
    ...

This would prevent allure reports from considering these the same text or having to write the tests once for each browser. I did figure out how to do tags like this but it didn't cause allure to treat them any differently so the most recent browser is the only version of the test that shows up.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source