Using parameters as custom variables?

We run our tests in non gui mode and pass various parameters, such as server, port, threads, etc. We would also like to run our test in GUI mode and be able to change these parameters in the GUI.

What I wanted to do was to use 2 user-defined variable objects and has one with static data that we can edit, and the other with parameters. Thus, the actual test plan does not change, but we can set the variables as parameters and simply disable static data. Or disable parameterized when we want to run static data.

But this does not seem to work - there are no errors.

+4
source share
3 answers

I am doing something similar, but I used UDF for this.

What I did was set up my variables and use the default values.

VARNAME VALUE otl_PROTOCOL ${__P(otl_protocol,https)} otl_PORT ${__P(otl_port,443)} otl_THREADS ${__P(otl_threads,1)} otl_REPS ${__P(otl_reps,1)} otl_RAMP ${__P(otl_ramp,0)} 

I made one for the server name. That way, I can use the default settings here, or I can pass parameters on the args command line or in my user.properties. This is very good for me.

+4
source

How do you pass values ​​from non-GUI mode? via CSV, using properties, user parameters, etc.?

If CSV, this is a simple fix. Just create the User Defined Variables (UDV) object at the level of the test plan and the "hard code" of all your parameters (server, port, etc.). Save the CSV configuration. If you run GUI mode, disable CSV and enable UDV. When you save the file, keep the CSV turned on and the UDV disabled - this way when you start from a non-GUI, it will read the CSV file.

If you use properties, I would do the following: Create a UDV with all your parameters (Server, etc.). Before entering values, copy the component so that you have two identical UDVs. In UDV 1, enter the value of the property from the command line. In UDV 2, enter hardcoded values. Throughout the script, replace any property references with variable references. It will look something like this:

  UD1: UD2: Name Value Name Value SERVER ${__P(Server)} SERVER devdomain.com PORT ${__P(Port)} PORT 4111 Some HTTP Request Domain: ${SERVER} 

If you use custom parameters, this will be the same concept as above.

+1
source

I actually use a function called a regular expression to get the value. here I have to use the variable under the variable because there are many values ​​with the same border, so I selected one paragraph as ${ABC} and the selection from this paragraph is ${XYLEM} . and a variable created as a regular expression. Using ${__V(ABC${XYLEM})};

 ${__setProperty{Search_Investment_Banking,$Investment_Banking}}; 
0
source

All Articles