Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes


Accepted answer

Permanent link
 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

Leesen Padayachee selected this answer as the correct answer

0 votes

Comments

 Dawn, thank you so much for your assistance. I managed to pass the variables to the .py script!

1 vote


One other answer

Permanent link
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.

0 votes

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!

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 1,381

Question asked: Dec 07 '16, 4:52 a.m.

Question was seen: 4,333 times

Last updated: Feb 16 '17, 1:07 a.m.

Confirmation Cancel Confirm