How can I set the value of a context variable from the command line for execution?
Question ID: 361
0
0

I am compiling a test and running it from the command line.  How can I pass a value to my tests from the command line?

Marked as spam
Posted by (Questions: 4, Answers: 4)
Asked on June 19, 2023 6:41 pm
13 views

Answers (1)

0
Private answer

This answer depends in your execution template. During execution, a variable replacement value will be realized in the following order.  While this can be modified by changing your generation template, this is the standard contract

  1. We lookup the key as a system/environment variable.  Regardless of the lookup type (data, context, secret, etc), this is the first step.  If this value is set, it is always used
  2. We lookup the key as a context variable.  Following the same pattern as #1, we can override any lookup with a context variable.
  3. Finally, we use the defined lookup (secret,data,environment, etc).

For templates based off of Java you can use the -D command line parameter to set a variable.  For example, if I had context variable named myValue and I wanted to set that to true at runtime I would do something like this for a suite named Actions.

java -DmyValue="true" -jar Actions.jar

cm

 

Marked as spam
Posted by (Questions: 0, Answers: 38)
Answered on June 26, 2023 7:22 am

Welcome to Alchemy Center!
Please Log In to participate in the discussion.

X
Scroll to Top