How to define execution variables in the batch script
![]()
Leesen Padayachee (99●60●120)
| asked Dec 07 '16, 4:52 a.m.
retagged Dec 16 '16, 1:00 a.m. by Minakshi Jaint (511●3)
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
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!
|
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.