Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How to access active environment name in localsettings.properties file

abhaysabu
abhaysabu Posts: 10

I've multiple environments (like QA, SIT, UAT) where test suites executed. I'm getting the report in my inbox, but I need to have active environment name in subject line, like report.mail.subject= API Execution Report - {Environment name where it executed}

I tried these but won't fetching the environment name - env_name, env_var, soa_env, environment.

Also I've added the environment name (like env_name=QA) in associated Environment file, but still it won't display in email's subject line.

How to access active environment name in localsettings.properties file?

Comments

  • jakubiak
    jakubiak Posts: 813 admin

    Unfortunately there is no variable that you can reference to inject the name of the active environment into the email subject line. One option is to use two localsettings files. One localsettings file has properties that are common for all environments. The other localsettings file is different for each environment, and contains a different value for the email subject line. In each SOAtest exeuction, you pass both the common localsettings file and the specific localsettings file for that environment.

  • benken_parasoft
    benken_parasoft Posts: 1,302 ✭✭✭

    It isn't uncommon to have a localsettings file that you use as a template, where you have a script that makes a copy of the template and does string replacements (for example) to inject any dynamic values before calling soatestcli -localsettings {filename}.

    If you are using Apache Ant, there are the PropertyFile and ReplaceRegExp tasks. From a bash script you could use something like GNU sed to perform string substitutions in a file.