How to define execution variables in the batch script
Hi
When defining the execution variable before executing a command line script, how do would be define these variables in the batch file? I have read that these need to be passed as an environment variable to the batch script that calls the script(python in my case). It has to be in the form "qm_some variable". Please advise on how I would state this in the batch file.
Thanks,
Leesen
Accepted answer
Leesen,
You don't have to define the qm_ version of the variables. RQM does that for you.
Not knowing what you are wanting to achieve, I am going to assume that you want to pass the execution variable values to the Python script. You can pass the values as follows:
python c:\test\test.py %qm_var_age% %qm_var_color%
****************************
There is another option. RQM also supplies a file that contains all the execution variables and their values. The file can be accessed using the variable %qm_ExecutionVariablesFile%. You can "echo" to see the contents. For instance, when you open this file, it may contain
var_age = 15
var_color = pink
Notice the qm_ prefix is not used inside this file.
In this case you can use the following command. Within the Python script, you can retrieve the values.
python c:\test\test.py %qm_ExecutionVariablesFile%
****************************
You can also modify the values to be used in downstream test cases or add new execution variables and values to be used in downstream test cases by modifying the content of %qm_ExecutionVariablesFile%
We found this information at this URL and also through experimentation.
https://jazz.net/help-dev/clm/index.jsp?re=1&topic=/com.ibm.rational.test.qm.doc/topics/qm/Test-Artifacts-Workflows-State-Group.html?resultof=%22workflow%22%20&scope=null
One other answer
For this example, there are 2 execution variables defined. They can be defined in the test suite, test case, and/or test script:
var_age = 15
var_color = red
When the command line script (.cmd or .bat) is invoked, the script accesses the variables as follows:
%qm_var_age%
%qm_var_color%
I believe this will also work for project variables, but the value is an enum rather than a string value.
Comments
Hi Dawn
Thank you for the response.
How would %qm_var_age% be defined in the batch file? This is an example of my batch file:
@echo off
python c:\test\test.py %*
echo LOGFILE=C:/pyAutomationFramework/Data/Scripts/RunScripts_20150319_110347_72/logfile.html >> %qm_AttachmentsFile%
As you can see my log file attachment is defined with an echo statement.
Can I just state it as :
%qm_var_age%
%qm_var_color%
and then create 2 input variable called " var_age" and "var_color" in my python script?
Thanks for your help!