Till now, I was setting the testEnvironment variable in jameleon.conf file. I have several different test environments.
Ex:
testEnvironment=ABC
#testEnvironment=XYZ ---> Notice that it is commented out
I created the corresponding ...-Applications.properties files, (ABC-Applications.properties, XYZ_Applications.properties etc) to define other variables.
And I am reading the testEnvironment variable from jameleon.conf file in my business function, like:
String testEnvironment = Configurator.getInstance().getValue("testEnvironment");
Magically (I couldn't figure it out how yet, that's why I call it magically), this line in my code is calling the the right ...-Applications.properties file to help me read the other parameters.
So, I'd like to override the testEnvironment variable in conf file from my testcase tag.
I did the following without any luck:
<testcase xmlns="jelly:jameleon" xmlns:jl="jelly:core" testEnvironment="XYZ">
I also tried to set it out, like:
<testcase xmlns="jelly:jameleon" xmlns:jl="jelly:core" >
<jl:set var="testEnvironment" value="XYZ"/>
But, it still reads and acts on the testEnvironment indicated on the jameleon.conf. (In this example, it is reading testEnvironment=ABC)
I know that testEnvironment variable is not a mandatory field in jameleon.conf, but I'd like to know how to override it from testcase tag, if it is possible at all.
Regards,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are crossing two different things here. One is variables to be used inside the scripts and another is configuration settings to be used that will change the way Jameleon acts.
Settings in Jameleon.conf are config settings. The settings are stored in the Configurator and is different from variables.
Variables are defined in either the scripts or the properties files (app.properties).
When you call <jl:set .../> you are setting variables which are stored in a context and not in Configurator.
I kind of broke the rules when I allowed configuration settings to be made via the scripts.
I just looked at the source code and it looks like jameleon.conf overrides all settings in the script. In other words, what are trying to do isn't supported directly.
However, you might be able to keep a separate configuration file for those scripts you want to do this for. You can set the name of the jameleon.conf file to use in the test case tag itself. If you do this, don't forget to set the complete file name (i.e. someFile.conf)
Hope this helps.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you, Christian, for the tip. It worked fine.
In summary, to override a variable in jameleon.conf, I created a "empty.conf" file and used it from the testcase tag, like:
<testcase xmlns="jelly:jameleon" jameleonConfigName="empty.conf" testEnvironment="XYZ">
So, occasionally breaking the rules is not a bad thing to do :)
Cheers,
Ayhan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it possible to override a variable (specifically testEnvironment varaible) from jameleon.conf in testcase?
I believe so.
Till now, I was setting the testEnvironment variable in jameleon.conf file. I have several different test environments.
Ex:
testEnvironment=ABC
#testEnvironment=XYZ ---> Notice that it is commented out
I created the corresponding ...-Applications.properties files, (ABC-Applications.properties, XYZ_Applications.properties etc) to define other variables.
And I am reading the testEnvironment variable from jameleon.conf file in my business function, like:
String testEnvironment = Configurator.getInstance().getValue("testEnvironment");
Magically (I couldn't figure it out how yet, that's why I call it magically), this line in my code is calling the the right ...-Applications.properties file to help me read the other parameters.
So, I'd like to override the testEnvironment variable in conf file from my testcase tag.
I did the following without any luck:
<testcase xmlns="jelly:jameleon" xmlns:jl="jelly:core" testEnvironment="XYZ">
I also tried to set it out, like:
<testcase xmlns="jelly:jameleon" xmlns:jl="jelly:core" >
<jl:set var="testEnvironment" value="XYZ"/>
But, it still reads and acts on the testEnvironment indicated on the jameleon.conf. (In this example, it is reading testEnvironment=ABC)
I know that testEnvironment variable is not a mandatory field in jameleon.conf, but I'd like to know how to override it from testcase tag, if it is possible at all.
Regards,
You are crossing two different things here. One is variables to be used inside the scripts and another is configuration settings to be used that will change the way Jameleon acts.
Settings in Jameleon.conf are config settings. The settings are stored in the Configurator and is different from variables.
Variables are defined in either the scripts or the properties files (app.properties).
When you call <jl:set .../> you are setting variables which are stored in a context and not in Configurator.
I kind of broke the rules when I allowed configuration settings to be made via the scripts.
I just looked at the source code and it looks like jameleon.conf overrides all settings in the script. In other words, what are trying to do isn't supported directly.
However, you might be able to keep a separate configuration file for those scripts you want to do this for. You can set the name of the jameleon.conf file to use in the test case tag itself. If you do this, don't forget to set the complete file name (i.e. someFile.conf)
Hope this helps.
Thank you, Christian, for the tip. It worked fine.
In summary, to override a variable in jameleon.conf, I created a "empty.conf" file and used it from the testcase tag, like:
<testcase xmlns="jelly:jameleon" jameleonConfigName="empty.conf" testEnvironment="XYZ">
So, occasionally breaking the rules is not a bad thing to do :)
Cheers,
Ayhan