1

Hello, I am working on junit load tests with jmeter. For this purpose, I am taking selenium webdriver and running it with selenium junit testing. when i run this code with junit on selenium webdriver,its working fine. But when i am trying to do the same thing with 20 threads in jmeter, then I am facing the following issues.

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)

please help me out with this problem.

  • Possible duplicate of [How do I fix a NoSuchMethodError?](https://stackoverflow.com/questions/35186/how-do-i-fix-a-nosuchmethoderror) – crizzis May 29 '17 at 10:42

1 Answers1

0

Just make sure that you jave all the libraries from your standalone JUnit project in JMeter Classpath as it looks like you are suffering from this issue or derivative.

Going forward make sure that your questions includes:

  • code, you are trying to run
  • dependency libraries of your project
  • contents of "lib" folder of your JMeter installation
  • jmeter.log file

Also be aware that there is a WebDriver Sampler available via JMeter Plugins project which provides JMeter and Selenium integration, this way tests development will be much faster as you won't have to recompile your module, copy jar(s) to JMeter's "lib/junit" folder, restart JMeter, etc.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133