1|0JMeter做UI自动化
不推荐,好别扭,但可行
2|0插件安装
- 搜插件selenium,安装
3|0添加config
- 添加线程组
- 右键线程组->添加->配置元件->jp@gc - Chrome Driver Config
- option和proxy不解释了
4|0添加Sampler
-
右键线程组->添加->取样器->jp@gc - WebDriver Sampler
-
script language 选择:JavaScript(可惜没有python)
-
界面说明
- Name - for the test that each Web Driver Sampler will have. This is used by the reports.
- Parameters - is optional and allows the reader to inject variables used in the script section.
- Script - allows the scripter to control the Web Driver and capture times and success/failure outcomes
5|0DEMO代码及解释
- 示例代码
-
WDS就是Web Driver Sampler
-
麻烦的是你可能并没有自动补齐(好像可以出来,但没研究),这个对象有哪些属性方法
-
深入的研究要看
-
比如显式等待的一个应用
5|1关于WDS的一些属性
- WDS.name - is the value provided in the Name field (above).
- WDS.vars - JMeterVariables - e.g.
vars.get("VAR1"); vars.put("VAR2","value"); vars.remove("VAR3"); vars.putObject("OBJ1",new Object());
- WDS.props - JMeterProperties (class
java.util.Properties
) - e.g.
props.get("START.HMS"); props.put("PROP1","1234");
- WDS.ctx - JMeterContext
- WDS.parameters - is the value provided in the Parameters field (above).
- WDS.args - is an array of the strings provided in the Parameters field, but split by the space ' ' character. This allows the scripter to provide a number of strings as input and access each one by position.
- WDS.log - is a Logger instance to allow the scripter to debug their scripts by writing information to the jmeter log file (JMeter provides a GUI for its log entries)
- WDS.browser - is the configured Web Driver browser that the scripter can script and control. There is detailed documentation on this object on the Selenium Javadocs page.
- WDS.sampleResult - is used to log when the timing should start and end. Furthermore, the scripter can set success/failure state on this object, and this SampleResult is then used by the JMeter reporting suite. The JMeter javadocs provide more information on the API of this object
__EOF__
本文作者:老吴的博客
本文链接:https://www.cnblogs.com/wuxianfeng023/p/17150643.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!
本文链接:https://www.cnblogs.com/wuxianfeng023/p/17150643.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!