【问题标题】:Running selenium code with junit and jmeter使用 junit 和 jmeter 运行 selenium 代码
【发布时间】:2016-01-17 09:16:41
【问题描述】:

我从我的 selenium 代码创建 jar 文件,我的代码是为了测试网站所以我用 junit 包围,现在我试图用 jmeter 运行它,我得到下一个错误:

2016/01/17 11:06:19 警告 - jmeter.gui.util.MenuFactory:缺少罐子?无法创建 com.googlecode.jmeter.plugins.webdriver.sampler.gui.WebDriverSamplerGui。 java.lang.NoClassDefFoundError: jsyntaxpane/DefaultSyntaxKit 2016/01/17 11:06:19 信息 - jmeter.util.BSFTestElement:注册 JMeter 版本的 JavaScript 引擎作为 BSF-22 的工作轮 2016/01/17 11:06:19 信息 - jmeter.protocol.http.sampler.HTTPSamplerBase:找不到.className htmlParser 的属性,使用默认值 2016/01/17 11:06:19 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase:文本/html的解析器是 2016/01/17 11:06:19 信息 - jmeter.protocol.http.sampler.HTTPSamplerBase:解析器 应用程序/xhtml+xml 是 2016/01/17 11:06:19 信息 - jmeter.protocol.http.sampler.HTTPSamplerBase:解析器 应用程序/xml 是 2016/01/17 11:06:19 信息 - jmeter.protocol.http.sampler.HTTPSamplerBase:文本/xml 的解析器是
2016/01/17 11:06:19 信息 - jmeter.protocol.http.sampler.HTTPSamplerBase:解析器 文本/vnd.wap.wml 是 org.apache.jmeter.protocol.http.parser.RegexpHTMLParser 2016/01/17 11:06:19 信息 - jmeter.gui.util.MenuFactory:跳过 org.apache.jmeter.protocol.http.control.gui.WebServiceSamplerGui 2016/01/17 11:06:19 信息 - jmeter.gui.util.MenuFactory:跳过 org.apache.jmeter.protocol.http.modifier.gui.ParamModifierGui 2016/01/17 11:06:19 信息 - jorphan.exec.KeyToolUtils:找到 keytool 在 'C:\Program Files\Java\jre1.8.0_66\bin\keytool' 2016/01/17 11:06:19 信息 - jmeter.protocol.http.proxy.ProxyControl:HTTP(S) 测试 脚本记录器 SSL 代理将使用支持嵌入式 3rd 的密钥 档案中的派对资源 C:\Users\orela\Desktop\apache-jmeter-2.13\apache-jmeter-2.13\bin\proxyserver.jks 2016/01/17 11:06:23 信息 - jmeter.samplers.SampleResult:注意:示例 时间戳是 START 时间 2016/01/17 11:06:23 INFO - jmeter.samplers.SampleResult:sampleresult.default.encoding 设置为 ISO-8859-1 2016/01/17 11:06:23 信息 - jmeter.samplers.SampleResult: sampleresult.useNanoTime=true 2016/01/17 11:06:23 信息 - jmeter.samplers.SampleResult:sampleresult.nanoThreadSleep=5000 2016/01/17 11:06:33 错误 - jmeter.gui.GuiPackage:问题 检索 gui java.lang.NullPointerException 在 org.apache.jmeter.gui.GuiPackage.getTestElementCheckSum(GuiPackage.java:853) 在 org.apache.jmeter.gui.GuiPackage.updateCurrentNode(GuiPackage.java:435) 在 org.apache.jmeter.gui.GuiPackage.getCurrentGui(GuiPackage.java:272) 在 org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:45) 在 org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81) 在 org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40) 在 org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63) 在 java.awt.event.InvocationEvent.dispatch(Unknown Source) 在 java.awt.EventQueue.dispatchEventImpl(未知来源)在 java.awt.EventQueue.access$500(未知来源)在 java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) 在 java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(未知 源)在 java.awt.EventQueue.dispatchEvent(未知源)在 java.awt.EventDispatchThread.pumpOneEventForFilters(未知来源) 在 java.awt.EventDispatchThread.pumpEventsForFilter(未知来源) 在 java.awt.EventDispatchThread.pumpEventsForHierarchy(未知 来源)在 java.awt.EventDispatchThread.pumpEvents(未知来源) 在 java.awt.EventDispatchThread.pumpEvents(Unknown Source) 在 java.awt.EventDispatchThread.run(未知来源)enter image description here

【问题讨论】:

  • 请添加您的代码,错误是 NullPointerException,这意味着您正在尝试使用空对象做某事。
  • 另外,您应该检查是否可以将 jsyntaxpane/DefaultSyntaxKit 放到类路径中
  • 代码在 intellij\eclips 中运行良好,仅在 jmeter 中运行时出错。

标签: java selenium junit jmeter jmeter-plugins


【解决方案1】:

你是否添加了 selenium-->libs(复制库中的所有 jars)到 jmeter/lib 和 jmeter/lib/ext 中(并删除重复的旧版本的 jars)

【讨论】:

  • 是的,我添加了罐子
【解决方案2】:

首先你的设置有问题,因为缺少一些 jar:

jmeter.gui.util.MenuFactory:缺少 jar?无法创建 com.googlecode.jmeter.plugins.webdriver.sampler.gui.WebDriverSamplerGui。 java.lang.NoClassDefFoundError: jsyntaxpane/DefaultSyntaxKit

这个? :

https://code.google.com/p/jsyntaxpane/

但您还面临在夜间构建中修复的错误:

尝试使用夜间构建并修复第一个问题:

安装 JMeter 运行时 下载 _bin 和 _lib 文件 将档案解压到相同的目录结构中 运行 JMeter 不需要其他档案。

【讨论】:

  • 嗨@UBIK LOAD PACK,我不明白你的回答,你可以给我更多细节
猜你喜欢
  • 1970-01-01
  • 2017-12-24
  • 2012-06-21
  • 2011-12-10
  • 1970-01-01
  • 1970-01-01
  • 2020-03-21
  • 2011-10-09
  • 1970-01-01
相关资源
最近更新 更多