JMeter is an open source load testing tool, with many capabilities. One of the many interesting things which can be done is to integrate a webdriver test into a JMeter test suite.

Before start make sure that Java and JMeter properly installed, and the webdriver libraries are downloaded. You can download them from the following links:

The following step is to create a new project in Eclipse with a webdriver test. To keep it simple the test just hits the google.com page, and will check its title.

To create a project:
– Click File -> New- > Java Project

New Java Project

New Java Project

– Enter project name -> click Finish

New Java Project Name

New Java Project Name

Add the webdriver and JUnit 4 libraries to the build path:
To do this right click on the project -> Build Path -> Add libraries
Add Libraries
Choose JUnit and select change the version to Junit4 -> click Finish
JUnit 4

Copy the downloaded webdriver libraries into the project’s lib folder and add them too to the build path.
After the addition the project structure should look like this:

Project structure

Now the project setup is done and we can start the coding:

package jmetertest;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;

public class Login {
    WebDriver driver;

    @Before
	public  void setUp(){
		FirefoxProfile profile = new FirefoxProfile();
		driver = new FirefoxDriver(profile);
	}

    @Test
	public void testLoadingFirstPage() throws Exception{
		driver.get("http://www.google.com/");
		Assert.assertEquals("Google",driver.getTitle());
	}

    @After
	public void tearDown() {
		driver.quit();

	}
}

In the code before the test we simply initialize the webdriver with a basic firefoxDriver and profile, the test loads the google.com page and then checks its title and close the driver when it’s done.

Be sure to mark the test with the @Test annotation, because JMeter will only loads tests which are marked.

So far, so good. The next step is to export the project as a jar file into the jmeter’s test folder

Click on File -> Export the export dialog will appear.
Choose Java- >Jar file -> click next

Export

On the export settings page check the project to export and set the export destination to where JMeter is installed, like on the screenshot: “C:\Users\WardenX\Downloads\apache-jmeter-2.8\lib\junit\test.jar”
You could rename text.jar to yourTestProject.jar to give it some meaning. It is a good practice to give meaningful names to classes, and exported files, it makes things easier to track.

JAR export

The test.jar should be in place now. And the last thing need to be done before running the test is to copy the webdriver libraries to the Jmeter’s lib folder. (Which in this case is: C:\Users\WardenX\Downloads\apache-jmeter-2.8\lib)

Just in case made a screenshot of the lib folder too:

Lib folder

Now start up JMeter and create a basic test plan by adding a “thread group” and a “Once Only” logic controller to it. After this the test Plan should look like the on the screenshot below.

Basic Test PLan

To be able to run JUnit test we should add a “JUnit Request” to the Once only logic controller.

Basic Plan Test

If the earlier steps were correctly done the export class should appear on the JUnit Request configuration page, and you can choose the Test Method – the one with the @Test annotation – from the list.

Basic Plan Test

Now if you click on the Green play button the test will start to execute.

Posted By Tihomir Turzai

    34 Responses to “How to integrate a JUnit4 – Webdriver test into JMeter”

  1. moiz says:

    Hi,

    What are advantages of integrating webdriver scripts with jmeter. Does it provide any real add on. Because as soon as u use webdirver scripts jmeters ability to spawn hundreds of thread is gone because webdriver scripts open up a browser which is hardware intensive.

    • Hi,

      Yes, you can’t spawn hundreds of threads on one machine, and yes it is more hardware intensive.
      All of the technologies / methods have advantages and disadvantages. It all depends on the goals of the testing.

      An advantage is that the whole code going to be executed in a real browser environment you can check the data precision and identify other types of bottlenecks during the performance testing.
      We are using this combination to test JS heavy applications where we have to watch for some special error messages.
      Another advantage is that if you have Webdriver test cases already implemented for functional testing you can reuse them to do this type of performance testing or just use it for quick a reconnaissance to check if the server is ready for more heave loads.

      Of course if your goal is to just send out a heavy load to a server and you just want to see how the server slows down the regular JMeter script is better.

  2. Rishil Bhatt says:

    I am trying the same you have described above.

    But when I am running the jmeter, nothing is happening.

    After waiting for some time when I stop the execution,

    JUnint request is displayed in red.
    Nothing is displayed in Response data tab.

    Below is the java class I am using :

    package com.core.testscript;

    import junit.framework.TestCase;

    import org.junit.Before;
    import org.junit.Test;
    import org.junit.After;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.firefox.FirefoxProfile;

    public class Selenium_Jmeter extends TestCase {
    WebDriver driver;

    @Before
    public void setUp() {
    FirefoxProfile profile = new FirefoxProfile();
    driver = new FirefoxDriver(profile);
    }

    @Test
    public void testSelenium_test() throws Exception {
    driver.get(“http://www.google.co.in/”);
    Thread.sleep(4000);
    driver.findElement(By.xpath(“//td[2]/div/input”)).clear();
    driver.findElement(By.xpath(“//td[2]/div/input”)).sendKeys(“Automation testing”);
    driver.findElement(By.xpath(“//button”)).click();
    Thread.sleep(6000);

    }

    @After
    public void tearDown() {
    driver.quit();
    }
    }

  3. MUKUL GOEL says:

    Thanks in Advance,

    ClassName & TestMethod is not showing as selected when i use the “Junit Request”

  4. Mans says:

    Hi,
    I tried above tutorial but getting stuck with jmeter:
    2014/07/31 10:57:46 INFO – 2014/07/31 10:57:46 INFO – jmeter.protocol.java.sampler.JUnitSampler: Trying to find constructor with one String parameter returned error: basictest.(java.lang.String) : basictest.(java.lang.String)

    any idea how to solve this

    • Can’t really tell without the code but if you used exact same as in the blog post, the error should be in the JMeter sampler configuration. You can check the configurations in the last picture of the blog post.

  5. Venkatesh says:

    I followed all above steps, but execution was not successful. Here is the “log” information

    LOG:
    2014/10/09 13:08:16 INFO – jmeter.engine.StandardJMeterEngine: Running the test!
    2014/10/09 13:08:16 INFO – jmeter.samplers.SampleEvent: List of sample_variables: []
    2014/10/09 13:08:16 INFO – jmeter.gui.util.JMeterMenuBar: setRunning(true,*local*)
    2014/10/09 13:08:16 INFO – jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
    2014/10/09 13:08:16 INFO – jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group.
    2014/10/09 13:08:16 INFO – jmeter.engine.StandardJMeterEngine: Thread will continue on error
    2014/10/09 13:08:16 INFO – jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false
    2014/10/09 13:08:16 INFO – jmeter.threads.ThreadGroup: Started thread group number 1
    2014/10/09 13:08:16 INFO – jmeter.engine.StandardJMeterEngine: All thread groups have been started
    2014/10/09 13:08:16 INFO – jmeter.threads.JMeterThread: Thread started: Thread Group 1-1
    2014/10/09 13:08:16 INFO – jmeter.protocol.java.sampler.JUnitSampler: Trying to find constructor with one String parameter returned error: com.example.jmeter.User_jmeter.(java.lang.String)
    2014/10/09 13:08:16 ERROR – jmeter.threads.JMeterThread: Error while processing sampler ‘jp@gc – Web Driver Sampler’ : java.lang.IllegalArgumentException: Browser has not been configured. Please ensure at least 1 WebDriverConfig is created for a ThreadGroup.
    at com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler.sample(WebDriverSampler.java:35)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
    at java.lang.Thread.run(Unknown Source)

    2014/10/09 13:09:03 INFO – jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1
    2014/10/09 13:09:03 INFO – jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test
    2014/10/09 13:09:03 INFO – jmeter.gui.util.JMeterMenuBar: setRunning(false,*local*)

    ** please tell me how to solve this issue.

    • It seems like you added a webdriver plugin to the JMeter which you want to use. Your sampler ‘jp@gc – Web Driver Sampler’ is missing a config file. You can find it under “Config Element” -> “jp@gc – Firefox Driver Config”.

  6. Dmitri T says:

    Thanks for sharing, much appreciated. In my turn I would suggest to check out How to Use JUnit With JMeter for information on how to set classpath for JUnit sampler, how to pass JMeter Variables into JUnit and backwards and more.

  7. Revathi says:

    ClassName & TestMethod is not showing as selected when i use the “Junit Request”

    • Try to check “Search for JUnit 4 annotations (instead of JUnit 3)” in the JUnit Request. Most likely your tests are JUnit4 and probably that is the reason they don’t show up.

  8. krishnadhar says:

    i have been following this topic and tried to execute the same via my selenium script

    package jmeterSamplers;

    import java.util.concurrent.TimeUnit;

    //import junit.framework.Assert;

    import org.junit.After;

    import org.junit.Before;

    import org.junit.Test;

    import org.openqa.selenium.By;

    import org.openqa.selenium.WebDriver;

    import org.openqa.selenium.firefox.FirefoxDriver;

    public class Junit_Integration_Sample1 {

    public static WebDriver driver;

    public Junit_Integration_Sample1() {

    // TODO Auto-generated constructor stub

    }

    @Before

    public void setUp()

    {

    driver = new FirefoxDriver();

    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

    driver.manage().window().maximize();

    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

    driver.get(“http://www.google.co.in”);

    }

    @Test

    public void testnavigation()

    {

    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

    System.out.println(“Page Title is:”+driver.getTitle());

    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

    }

    @Test

    public void testsearchtext() throws InterruptedException

    {

    Thread.sleep(6000);

    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

    driver.findElement(By.id(“lst-ib”)).sendKeys(“Jmeter”);

    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

    //element.sendKeys(“Jmeter”);

    driver.findElement(By.id(“sblsbb”)).click();

    }

    @After

    public void tearDown()

    {

    driver.quit();

    }

    }

    Now this script is running perfectly when i run via eclipse. but when i try to run from the junit request sampler. i get the following error.

    Thread Name: Thread Group 1-1
    Sample Start: 1970-01-01 05:30:00 IST
    Load time: 0
    Latency: 0
    Size in bytes: 0
    Headers size in bytes: 0
    Body size in bytes: 0
    Sample Count: 1
    Error Count: 1
    Response code: 1000
    Response message:

    Response headers:

    SampleResult fields:
    ContentType:
    DataEncoding: windows-1252

    and the warnings window shows this…

    2015/03/12 15:07:49 INFO – jmeter.engine.StandardJMeterEngine: Running the test!
    2015/03/12 15:07:49 INFO – jmeter.samplers.SampleEvent: List of sample_variables: []
    2015/03/12 15:07:49 INFO – jmeter.gui.util.JMeterMenuBar: setRunning(true,*local*)
    2015/03/12 15:07:50 INFO – jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
    2015/03/12 15:07:50 INFO – jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group.
    2015/03/12 15:07:50 INFO – jmeter.engine.StandardJMeterEngine: Thread will continue on error

    2015/03/12 15:07:50 INFO – jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false
    2015/03/12 15:07:50 INFO – jmeter.threads.ThreadGroup: Started thread group number 1
    2015/03/12 15:07:50 INFO – jmeter.engine.StandardJMeterEngine: All thread groups have been started
    2015/03/12 15:07:50 INFO – jmeter.threads.JMeterThread: Thread started: Thread Group 1-1
    2015/03/12 15:07:50 INFO – jmeter.protocol.java.sampler.JUnitSampler: Trying to find constructor with one String parameter returned error: jmetertest1.Login.(java.lang.String)
    2015/03/12 15:07:59 INFO – jmeter.threads.JMeterThread: Thread is done: Thread Group 1-1
    2015/03/12 15:07:59 INFO – jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1
    2015/03/12 15:07:59 INFO – jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test
    2015/03/12 15:07:59 INFO – jmeter.gui.util.JMeterMenuBar: setRunning(false,*local*)

    any help would be appreciated in this regard…

    Thanks

    • I would say you don’t have the matching libraries for the webdriver you are using. Check if you have the correct versions and make sure you delete the incorrect versions from the JMeter lib folder.

  9. krishnadhar says:

    yeah i have done it. but still the same issue. it would be great if you have any video for the same…..

    Thanks

    • Sadly I can’t provide a video but here is a list of the libs that had an older version which I deleted: bsh, commons-jexl, commons-lang, commons-logging, httpclient, httpcore and httpmime. Check if you by any chance left an older version and delete it.

  10. Rajee r says:

    I have followed all the instructions but only browser opens and jmeter stops . I have tried with all combinations of browser and jars from 2.39 to 2.45

  11. Bharati says:

    I had a selenium-Webdriver script with me, and I wanted to perform Load testing on the script using JMeter. So What I have done is, 1) I have Exported selenium script into JMeter/Lib/Junit folder. 2) Configured JMeter with JUnit and Marked it to RUN.

    But, am receiving following error in Sample Request :

    Thread Name: Thread Group 1-1 Sample Start: 2015-04-29 14:48:38 IST Load time: 17190 Latency: 0 Size in bytes: 0 Headers size in bytes: 0 Body size in bytes: 0 Sample Count: 1 Error Count: 1 Response code: 1000
    and Log Viewer :

    2015/04/29 14:48:38 INFO – jmeter.engine.StandardJMeterEngine: Running the test! 2015/04/29 14:48:38 INFO – jmeter.samplers.SampleEvent: List of sample_variables: [] 2015/04/29 14:48:38 INFO – jmeter.samplers.SampleEvent: List of sample_variables: [] 2015/04/29 14:48:38 INFO – jmeter.gui.util.JMeterMenuBar: setRunning(true,local) 2015/04/29 14:48:38 INFO – jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group 2015/04/29 14:48:38 INFO – jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group. 2015/04/29 14:48:38 INFO – jmeter.engine.StandardJMeterEngine: Thread will continue on error 2015/04/29 14:48:38 INFO – jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false 2015/04/29 14:48:38 INFO – jmeter.threads.JMeterThread: jmeterthread.startearlier=true (see jmeter.properties) 2015/04/29 14:48:38 INFO – jmeter.threads.JMeterThread: Running PostProcessors in forward order 2015/04/29 14:48:38 INFO – jmeter.threads.ThreadGroup: Started thread group number 1 2015/04/29 14:48:38 INFO – jmeter.engine.StandardJMeterEngine: All thread groups have been started 2015/04/29 14:48:38 INFO – jmeter.threads.JMeterThread: Thread started: Thread Group 1-1 2015/04/29 14:48:38 INFO – jmeter.protocol.java.sampler.JUnitSampler: Trying to find constructor with one String parameter returned error: Jmetersmaple.(java.lang.String) 2015/04/29 14:48:55 INFO – jmeter.threads.JMeterThread: Thread is done: Thread Group 1-1 2015/04/29 14:48:55 INFO – jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1 2015/04/29 14:48:55 INFO – jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test 2015/04/29 14:48:55 INFO – jmeter.gui.util.JMeterMenuBar: setRunning(false,local)

  12. jhansi says:

    Thread Name: Thread Group 1-1
    Sample Start: 1970-01-01 05:30:00 IST
    Load time: 0
    Connect Time: 0
    Latency: 0
    Size in bytes: 0
    Headers size in bytes: 0
    Body size in bytes: 0
    Sample Count: 1
    Error Count: 1
    Response code: 9999
    Response message: Failed to create an instance of the class:null, reasons may be missing both empty constructor and one String constructor or failure to instantiate constructor, check warning messages in jmeter log file

    • That message usually means that there is no Classname selected in the JUnit Request. It can also happen that you replaced the example jar in in the junit folder. if you replace or delete the test.jar file JMeter will automatically deselect everything in the JUnit Request.

  13. Alex says:

    I have followed the above steps and created the jar file using eclipse and executed it through Jmeter. But its failing Below is the Sampler Result i get

    Thread Name: Thread Group 1-1
    Sample Start: 1970-01-01 05:30:00 IST
    Load time: 0
    Connect Time: 0
    Latency: 0
    Size in bytes: 0
    Headers size in bytes: 0
    Body size in bytes: 0
    Sample Count: 1
    Error Count: 1
    Response code: 200
    Response message:

    Response headers:

    SampleResult fields:
    ContentType:
    DataEncoding: windows-1252

    And in the Request Tab only the class name with the method name is being printed; the request details are not printing
    below is the jmetertest.Login.testLoadingFirstPage

    • Alex says:

      The issue got resolved. The issue was due to “httpclient” jar version. The Jmeter was trying to connect the firefox socket using the old jar. After copy-pasting the jars from webdriver to Jmeter lib path, kindly delete the old jar file – “htpclient-4.2 version” and use the latest version “httpclient-4.4.1”.

  14. raghavendra says:

    Hai i am getting the following issue please let me know what is the issue…

    2015/08/07 09:59:39 ERROR – jmeter.gui.GuiPackage: Problem retrieving gui java.lang.NullPointerException
    at org.apache.jmeter.gui.GuiPackage.getTestElementCheckSum(GuiPackage.java:853)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentNode(GuiPackage.java:435)
    at org.apache.jmeter.gui.GuiPackage.getCurrentGui(GuiPackage.java:272)
    at org.apache.jmeter.gui.util.MenuFactory.addFileMenu(MenuFactory.java:224)
    at org.apache.jmeter.gui.util.MenuFactory.addFileMenu(MenuFactory.java:200)
    at org.apache.jmeter.gui.util.MenuFactory.getDefaultSamplerMenu(MenuFactory.java:305)
    at org.apache.jmeter.samplers.gui.AbstractSamplerGui.createPopupMenu(AbstractSamplerGui.java:49)
    at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:158)
    at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:47)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
    at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
    at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672)
    at java.awt.EventQueue.access$400(EventQueue.java:81)
    at java.awt.EventQueue$2.run(EventQueue.java:633)
    at java.awt.EventQueue$2.run(EventQueue.java:631)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:642)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    2015/08/07 09:59:41 ERROR – jmeter.gui.GuiPackage: Problem retrieving gui java.lang.NullPointerException
    at org.apache.jmeter.gui.GuiPackage.getTestElementCheckSum(GuiPackage.java:853)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentNode(GuiPackage.java:435)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentGui(GuiPackage.java:416)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:73)
    at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
    at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672)
    at java.awt.EventQueue.access$400(EventQueue.java:81)
    at java.awt.EventQueue$2.run(EventQueue.java:633)
    at java.awt.EventQueue$2.run(EventQueue.java:631)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:642)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    2015/08/07 09:59:46 ERROR – jmeter.gui.GuiPackage: Problem retrieving gui java.lang.NullPointerException
    at org.apache.jmeter.gui.GuiPackage.getTestElementCheckSum(GuiPackage.java:853)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentNode(GuiPackage.java:435)
    at org.apache.jmeter.gui.GuiPackage.getCurrentGui(GuiPackage.java:272)
    at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:45)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
    at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
    at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672)
    at java.awt.EventQueue.access$400(EventQueue.java:81)
    at java.awt.EventQueue$2.run(EventQueue.java:633)
    at java.awt.EventQueue$2.run(EventQueue.java:631)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:642)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    2015/08/07 09:59:47 ERROR – jmeter.gui.GuiPackage: Problem retrieving gui java.lang.NullPointerException
    at org.apache.jmeter.gui.GuiPackage.getTestElementCheckSum(GuiPackage.java:853)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentNode(GuiPackage.java:435)
    at org.apache.jmeter.gui.GuiPackage.getCurrentGui(GuiPackage.java:272)
    at org.apache.jmeter.gui.util.MenuFactory.addFileMenu(MenuFactory.java:224)
    at org.apache.jmeter.gui.util.MenuFactory.addFileMenu(MenuFactory.java:200)
    at org.apache.jmeter.gui.util.MenuFactory.getDefaultSamplerMenu(MenuFactory.java:305)
    at org.apache.jmeter.samplers.gui.AbstractSamplerGui.createPopupMenu(AbstractSamplerGui.java:49)
    at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:158)
    at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:47)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
    at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
    at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672)
    at java.awt.EventQueue.access$400(EventQueue.java:81)
    at java.awt.EventQueue$2.run(EventQueue.java:633)
    at java.awt.EventQueue$2.run(EventQueue.java:631)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:642)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

  15. Jimmy says:

    My classes don’t show up in the Class names drop down for jmeter for some reason. The only think I can think of is that it’s because it’s junit 4.1. Should these still work?

    • Hi!
      Tried to use the mentioned junit version and it worked fine for me.
      Make sure you copied the exported jar file to the correct folder (apache-jmeter/lib/junit/) and in jmeter the ‘Search for JUnit 4 annotations’ checkbox is checked.

  16. VANI KARIKATI says:

    Hello, am getting the below issue when i run jmeter, i have followed the everything same as you but in my java code i have used Windows login authentication. Please clarify where am i doing the mistake

    Thread Name: Thread Group 1-1
    Sample Start: 1970-01-01 05:30:00 IST
    Load time: 0
    Latency: 0
    Size in bytes: 0
    Headers size in bytes: 0
    Body size in bytes: 0
    Sample Count: 1
    Error Count: 1
    Response code: 9999
    Response message: Failed to create an instance of the class:Login, reasons may be missing both empty constructor and one String constructor or failure to instantiate constructor, check warning messages in jmeter log file

    Response headers:

    SampleResult fields:
    ContentType:
    DataEncoding: null

  17. saran says:

    I am facing the issue of jmeter.protocol.java.sampler.JUnitSampler: Error instantiating class:class while running the jmeter script from Jenkins. I have raised this issue in SO as well at the below link

    Can you please help

  18. Harsh says:

    I am trying to test junit with jmeter and as soon as I make a junit Request in jmeter, I get warnings. I have copied the jar file in lib/junit. Thing is I have not even started the test!!!

    2015/11/06 15:34:09 INFO – jmeter.util.BSFTestElement: Registering JMeter version of JavaScript engine as work-round for BSF-22
    2015/11/06 15:34:09 INFO – jmeter.protocol.http.sampler.HTTPSamplerBase: Cannot find .className property for htmlParser, using default
    2015/11/06 15:34:09 INFO – jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/html is
    2015/11/06 15:34:09 INFO – jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xhtml+xml is
    2015/11/06 15:34:09 INFO – jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xml is
    2015/11/06 15:34:09 INFO – jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/xml is
    2015/11/06 15:34:09 INFO – jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser
    2015/11/06 15:34:09 INFO – jmeter.gui.util.MenuFactory: Skipping org.apache.jmeter.protocol.http.control.gui.WebServiceSamplerGui
    2015/11/06 15:34:09 INFO – jmeter.gui.util.MenuFactory: Skipping org.apache.jmeter.protocol.http.modifier.gui.ParamModifierGui
    2015/11/06 15:34:10 INFO – jorphan.exec.KeyToolUtils: keytool found at ‘C:\Program Files\Java\jre1.8.0_45\bin\keytool’
    2015/11/06 15:34:10 INFO – jmeter.protocol.http.proxy.ProxyControl: HTTP(S) Test Script Recorder SSL Proxy will use keys that support embedded 3rd party resources in file C:\Users\hkhuran\Desktop\apache-jmeter-2.13\apache-jmeter-2.13\bin\proxyserver.jks
    2015/11/06 15:34:10 INFO – jmeter.samplers.SampleResult: Note: Sample TimeStamps are START times
    2015/11/06 15:34:10 INFO – jmeter.samplers.SampleResult: sampleresult.default.encoding is set to ISO-8859-1
    2015/11/06 15:34:10 INFO – jmeter.samplers.SampleResult: sampleresult.useNanoTime=true
    2015/11/06 15:34:10 INFO – jmeter.samplers.SampleResult: sampleresult.nanoThreadSleep=5000
    2015/11/06 15:34:26 ERROR – jmeter.gui.GuiPackage: Problem retrieving gui java.lang.NullPointerException
    at org.apache.jmeter.gui.GuiPackage.getTestElementCheckSum(GuiPackage.java:853)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentNode(GuiPackage.java:435)
    at org.apache.jmeter.gui.GuiPackage.getCurrentGui(GuiPackage.java:272)
    at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:45)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
    at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
    at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    2015/11/06 15:34:26 ERROR – jmeter.gui.GuiPackage: Problem retrieving gui java.lang.NullPointerException
    at org.apache.jmeter.gui.GuiPackage.getTestElementCheckSum(GuiPackage.java:853)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentNode(GuiPackage.java:435)
    at org.apache.jmeter.gui.GuiPackage.getCurrentGui(GuiPackage.java:272)
    at org.apache.jmeter.gui.util.MenuFactory.addFileMenu(MenuFactory.java:224)
    at org.apache.jmeter.gui.util.MenuFactory.addFileMenu(MenuFactory.java:200)
    at org.apache.jmeter.gui.util.MenuFactory.getDefaultSamplerMenu(MenuFactory.java:305)
    at org.apache.jmeter.samplers.gui.AbstractSamplerGui.createPopupMenu(AbstractSamplerGui.java:49)
    at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:158)
    at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:47)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
    at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
    at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    2015/11/06 15:34:31 ERROR – jmeter.gui.GuiPackage: Problem retrieving gui java.lang.NullPointerException
    at org.apache.jmeter.gui.GuiPackage.getTestElementCheckSum(GuiPackage.java:853)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentNode(GuiPackage.java:435)
    at org.apache.jmeter.gui.GuiPackage.updateCurrentGui(GuiPackage.java:416)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:73)
    at org.apache.jmeter.gui.action.ActionRouter.doActionNow(ActionRouter.java:114)
    at org.apache.jmeter.gui.MainFrame.actionPerformed(MainFrame.java:796)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

  19. Anil says:

    How to execute multiple methods at a time so we can able to major multiple screen/screen wise performances is that possible?

  20. Sirisha says:

    Response message: An unexpected error occured
    Error — test01Basics(org.apache.jmeter.protocol.java.sampler.JUnitSampler$AnnotatedTestCase): null please help in fixing this I used proper jar & placed in lib folders

Leave a Reply




XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>