2017-05-29 54 views
1

您好, 我正在使用jmeter进行junit负载测试。为此,我正在使用硒webdriver并使用硒junit测试来运行它。当我运行这个代码与硒webdriver junit,其工作正常。但是当我试图用jmeter中的20个线程做同样的事情时,那么我正面临以下问题。jmeter的junit请求采样器等待条件不起作用

Error -- test(org.apache.jmeter.protocol.java.sampler.JUnitSampler$AnnotatedTestCase): org.openqa.selenium.support.ui.WebDriverWait.until(Ljava/util/function/Function;)Ljava/lang/Object; 
Trace -- java.lang.NoSuchMethodError: org.openqa.selenium.support.ui.WebDriverWait.until(Ljava/util/function/Function;)Ljava/lang/Object; 
    at SeleniumTestNG.LoginLogoutTest.test(LoginLogoutTest.java:55) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.apache.jmeter.protocol.java.sampler.JUnitSampler$AnnotatedTestCase.runTest(JUnitSampler.java:593) 
    at org.apache.jmeter.protocol.java.sampler.JUnitSampler$1.protect(JUnitSampler.java:673) 
    at junit.framework.TestResult.runProtected(TestResult.java:142) 
    at org.apache.jmeter.protocol.java.sampler.JUnitSampler.sample(JUnitSampler.java:395) 
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:491) 
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:425) 
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254) 
    at java.lang.Thread.run(Unknown Source) 
Error -- test(org.apache.jmeter.protocol.java.sampler.JUnitSampler$AnnotatedTestCase): org.openqa.selenium.support.ui.WebDriverWait.until(Ljava/util/function/Function;)Ljava/lang/Object; 
Trace -- java.lang.NoSuchMethodError: org.openqa.selenium.support.ui.WebDriverWait.until(Ljava/util/function/Function;)Ljava/lang/Object; 
    at SeleniumTestNG.LoginLogoutTest.tearDown(LoginLogoutTest.java:83) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.apache.jmeter.protocol.java.sampler.JUnitSampler.sample(JUnitSampler.java:399) 
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:491) 
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:425) 
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254) 
    at java.lang.Thread.run(Unknown Source) 

请帮我解决这个问题。

+0

可能的重复[如何修复NoSuchMethodError?](https://stackoverflow.com/questions/35186/how-doi-i-fix-a-nosuchmethoderror) – crizzis

回答

0

只要确保你从独立JUnit项目中的所有库中跳过JMeter Classpath,因为它看起来像是患有this issue或衍生产品。

今后确保您的问题包括:

  • 代码,您正试图运行项目的
  • 依赖库的安装Jmeter的“LIB”文件夹中的
  • 内容
  • jmeter.log文件

另请注意,有WebDriver Sampler可通过JMeter Plugins提供JMeter和Selenium集成的项目,这样测试开发将会快得多,因为您不必重新编译模块,将jar复制到JMeter的“lib/junit”文件夹,重新启动JMeter等。

相关问题