使用参数作为用户定义的变量? [英] Using parameters as user Defined Variables?

查看:149
本文介绍了使用参数作为用户定义的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们以非GUI模式运行测试,并传入服务器,端口,线程等各种参数.我们还希望以GUI模式运行测试,并能够在GUI中更改这些参数.

We run our tests in non gui 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.

我想做的是使用2个用户定义的变量对象,其中一个带有可编辑的静态数据,另一个带有参数.这样,实际的测试计划就不会改变,但是我们可以将变量设置为参数,而只需禁用静态数据即可.或者,当我们要使用静态数据运行时,请禁用参数化的参数.

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.

推荐答案

我做了类似的事情,但是为此我使用了UDF.

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)}  

我也为服务器名称做了一个.这样,我可以在此处使用默认值,也可以在命令行args或user.properties中传递参数.这对我来说很好.

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.

这篇关于使用参数作为用户定义的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆