It's all about the answers!

Ask a question

Environment variable in test script command line


Miriam Kilav (156) | asked Feb 12 '17, 11:35 a.m.

On our design, we use test script with command line option.

The command line is supposed to have an environment variable inside it.
For example: %LOCATION%\script.sh.
Meaning, the location of the script depends on the value of the environment variable.
I couldn't find a way to execute this command line with environment variable. Tried %VAR%, $VAR and etc.
Is there a way to do that? 


Comments
Donald Nong commented Feb 12 '17, 9:17 p.m.

I'm a bit confused with what you want to achieve. If you want to execute %LOCATION%\script.sh, shouldn't you just pass a value (path) to the environment variable LOCATION? Also, how do you execute your test script?


Miriam Kilav commented Feb 13 '17, 3:56 a.m.

 The value of LOCATION can be changed, actually it is different between our machines. So I can't know in advanced what will be the value.
We will trigger the test suite via an automatically tool (Jenkins) but I think it doesn't matter.

 


Donald Nong commented Feb 13 '17, 8:02 p.m.

I'm confused. You'd better explain your use case in more details. For example, from which machine do you trigger the test script? On which machine does your test script run? What environment variables does your test script receive (you can simply dump all the variables and check)?


Miriam Kilav commented Feb 15 '17, 12:52 p.m.

OK. I will try.

The CLA is installed on one of my machines. the test application is located on that machine as well.
the test suite has an environment variable called WORKSPACE.
The location of the workspace is different between the machines (workspace is where the test artifacts are, scripts and executables)
so one of the environment variables of the test suite is the location of the workspace
the location of the script that I'd like to call to in the Test Script command line depands on the value of the WORKSPACE location. 
For example: the script is located in WORKSPACE\scripts\script.sh. when WORKSPACE can be C:\temp, C:\folder and etc.
I don't have another way to call this script since I don't know before run time where the workspace is.
In general, we are integrating Jenkins with RQM. JEnkins will send REST API request that will trigger the test suite and will fill the WORKSPACE value before test suite execution.
I hope that now it is clear. Thanks a lot for your response


One answer



permanent link
Subhajit Bhuiya (6222) | answered Dec 01 '17, 9:49 a.m.
JAZZ DEVELOPER

 My suggestion is to print all the execution variables in a loop and check if the required variable is getting listed or not

Your answer


Register or 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.