I have a project that can be run on several environments. Each environment has a separate property file, ex: env1.properties, env2.properties.
To run a smoke test on env2, I will specify a run command like this:
mvn clean verify -DenvConfig=env2 -Dcucumber.filter.tags="@smoke"
What I want to do is grab the environment I am running on (in this case its env2) but also I want to grab the value of 2 of the variables in env2.properties and add to the custom report like its shown here: https://serenity-bdd.github.io/docs/reporting/reports_custom_info
I’d want to say something like
report.customfields.environment = {env2}
report.customfields.variable1 = {env2.properties.variable1}
report.customfields.variable2 = {env2.properties.variable2}
I see in the documentation that I can specify
report.customfields.environment = ${environment}
and then pass in the environment in the run command like:
-Denvironment=env2
But I am not sure how to use that to then navigate to the
srctestresourcesenvironmentsenv2.properties
file and extract out a variable to add to the report