Search code examples
appiumcucumber-jvmgherkincucumber-java

Modifying Feature name at run time or using environment variable/system property in feature file


I have an automation project that i've recently updated to run both a set of Android and iOS tests in parallel. I've got my report files aggregating ok, but since they're running the same features, the reports at the end can't really identify which ran on Android and which on iOS.

It is a pretty standard Cucumber, Gherkin, Java project. I'm trying to figure out the best way to get the word Android/iOS into the Feature name field, so on the generated report it can be easily identified.

The two options i've thought about are either during the @Before step, to somehow modify the feature name. However, it looks like all of the fields of the Scenario object have getters only.

The second option was if it was possible to reference a system property or environment variable in the .feature file itself. However, I haven't seen any ways that that is possible.

Has anyone tried this before? I can post code as necessary, it is more of a general question of how could I dynamically change a feature name, or alter a feature file itself by environment variable when it runs.

Thanks


Solution

  • I think this similar question may have the answer you're seeking.

    Basically, you're going to create your own runner type (or modify the existing one) and inside it set a custom report path.