开发者

Using parameters as user Defined Variables?

We run our tests in non gu开发者_如何转开发i mode and pass in various parameters like Server, port, threads etc. We'd 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 use 2x User Defined variable objects, and have one with static data we can edit, and another with parameters. That way the actual test plan doesn't change, but we can set variables as parameters, and just disable the static data one. Or disable the parameterized one when we want to run with static data.

But this doesn't seem to work - no errors nothing.


I do something similar, but I used a UDF for this.

What I did was set up my variables and use 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 did one for server name as well. This way, I can use the defaults here or I can pass in parameters in either the command line args or in my user.properties. This works very well for me.


How are you passing in values from non-GUI mode? via CSV, using properties, User-Parameters, etc.?

If CSV, this is an easy fix. Simply create a User Defined Variables (UDV) object at the Test Plan Level and "hard code" all your parameters (Server, port, etc.). Keep your CSV config. If you run in GUI mode, disable the CSV and enable the UDV. When you save the file, keep the CSV enabled and the UDV disabled - that way when you run from non-GUI it'll read the CSV file.

If using properties, I would do the following: Create a UDV with all your parameters (Server, etc.). Before entering values, copy the component so you have TWO identical UDVs. In UDV 1, enter the property value from the command line. In UDV 2, enter the "hard coded" values. Throughout your script, replace any references to the properties with variable references. It would 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 using user-parameters, it would be the same concept as above.


Actually i am using a function named as regular expression for getting value. here i have to use variable under variable because there is lots of value with same boundary, so i have selected one paragraph as ${ABC} and fetching value from this paragraph ${XYLEM}. both the variable created as regular expression.tried with ${__V(ABC${XYLEM})};

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜