如何在脚本中获取测试场景中配置的代理数?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

如何在脚本中获取测试场景中配置的代理数?

ypspace
需要在脚本中取得测试场景配置的Agent的总数,如何写哪?
Reply | Threaded
Open this post in threaded view
|

RE: 如何在脚本中获取测试场景中配置的代理数?

Mavlarn

获取agent个数,可以用:

grinder.getProperties().getInt("grinder.agents", 1)

你可以用这个properties获取所有的属性。

 

如果你用groovy类型的脚本,还可以用这个util类:

net.grinder.util.GrinderUtils.getAgentCount() 

 

 

-----Original Message-----
From: "ypspace [via ngrinder]"<[hidden email]>
To: "Mavlarn"<[hidden email]>;
Cc:
Sent: 2014-01-15 (星期三) 00:35:37
Subject: 如何在脚本中获取测试场景中配置的代理数?

需要在脚本中取得测试场景配置的Agent的总数,如何写哪?


If you reply to this email, your message will be added to the discussion below:
http://ngrinder.642.n7.nabble.com/-tp1214.html
To start a new topic under ngrinder-user-cn, email [hidden email]
To unsubscribe from ngrinder-user-cn, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

RE: 如何在脚本中获取测试场景中配置的代理数?

ypspace
已经测试过,grinder.getProperties()内没有grinder.agents字段,所以取不到配置的代理数量。
以下是grinder.getProperties()内容输出:
2014-01-15 14:25:11,382 INFO  Property: {grinder.duration=3660000, grinder.consolePort=12001, grinder.useConsole=true, grinder.security=false, ngrinder.etc.hosts=, grinder.runs=0, grinder.threads=3, grinder.reportTimesToConsole=true, grinder.jvm=java, grinder.dcrinstrumentation=true, grinder.test.id=test_157, grinder.processIncrement=0, grinder.script=testGrinder.py, grinder.numberOfOldLogs=10, grinder.logProcessStreams=true, grinder.consoleHost=10.1.21.202, grinder.sleepTimeFactor=1, grinder.debug.singleprocess=false, grinder.sleepTimeVariation=0.2, grinder.logDirectory=/home/test/.ngrinder_agent/log/test_157, grinder.user=test, grinder.processes=2, grinder.reportToConsole.interval=500, grinder.jvm.classpath=/home/test/ngrinder-core-3.2.1/./lib/ngrinder-dns-3.2.1.jar:/home/test/ngrinder-core-3.2.1/./lib/grinder-3.9.1-patch.jar:/home/test/.ngrinder_agent/file-store/test/current/:/home/test/.ngrinder_agent/file-store/test/current/lib, grinder.ignoreSampleCount=0}
Reply | Threaded
Open this post in threaded view
|

RE: 如何在脚本中获取测试场景中配置的代理数?

Matt
请更新版本至3.2.3,再试一下。
Reply | Threaded
Open this post in threaded view
|

RE: 如何在脚本中获取测试场景中配置的代理数?

ypspace
谢谢,更新版本后问题解决