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

CLA with python scripting

 Hi 

I am using the Command Line adapter with python scripts. I cannot seem to pass execution variable to this python script. There are examples that state that I need to define the a variable as "$qm_userName" ,

This does not seem to work in a python script. Please advise on how I need to define a variable in a python script so that I can pass execution variables from a Jazz test case level.

Thanks,
Leesen

0 votes



2 answers

Permanent link
These are passed to the script as environment variables

Something like this should work:

import os
name = os.environ("qm_userName")

etc

0 votes

Comments

 Hi David


So you say this has to be done in the .py script itself? and not in the batch file that we execute from RQM? The article https://jazz.net/library/article/809 talks about a batch script and gives the example : if [ -z "$qm_userName" ]. 

Will this variable need to defined in the batch script also?

Thanks,
Leesen


Permanent link
Well you don't have to have a batch file.  If your python script is sophisticated enough you can directly invoke it instead of a wrapper script.  Anything you can type as a single command for the command prompt can be a CLA script.  I don't know about windows but Unix like operating systems would pass the environment from the invoking shell script to the python script as well.  Try it - it is very easy to test - have python print one of your passed variables.  If you do it as a CLA script the output will be captured in the stdout file that gets attached to the execution result.

0 votes

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
× 11,074

Question asked: Dec 06 '16, 6:43 a.m.

Question was seen: 5,269 times

Last updated: Dec 07 '16, 10:03 a.m.

Confirmation Cancel Confirm