Thursday, September 2, 2010

Integrate jmeter with selenium junit

Step1. Record and convert your script to selenium java-junit format
using selenium ide.

Step2. open the eclipse and save that file as a java file.

Step3. Using junit run that file but before that you need to add
selenium-server.jar file in eclipse.

Step4. After that test runs successfully you will get .class file
under bin folder.

Step5. Setup your Run configuration settings for converting java file
to jar.

Step6. Select .java file and .class together and convert to .jar file.

Step7. Paste that .jar file into lib/junit folder.

Step8. start your j-meter server and see the magic.

6 comments:

  1. Hi,
    I did all posted steps but I cannot see my classes when selecting the class of the JUnit request in JMeter.
    Any ideas?

    Thanks in advance

    ReplyDelete
  2. Same problem ahahahahah see the magic, yes I can see it now ;-) My Jar magically can't be found. JMeter use the Jar because it's impossible to delete it when JMeter is started, but no way to access it... A step is probably missing and some steps are not described really good. For you it's probably clear, but you need to think like a beginners when you write an article.

    ReplyDelete
  3. I've found the missing step, you need to add the Selenium-Server Jar inside the lib directory of JMeter!

    ReplyDelete
  4. In the selenium script I have several checks, how do I get those results in jmeter?

    ReplyDelete
  5. Take the selenium script jar file and paste it in "\apache-jmeter-2.9\lib\junit" folder.
    Open the Jmeter and Create Thread group
    In that Thread group create Junit request and select the package name in the "Package Filter" and run it

    ReplyDelete
  6. Thanks for sharing. However it might be quicker and easier to use WebDriver Sampler plugin to be able to pass between JMeter and Selenium and won't have to recompile the jars/restart JMeter in case of anything goes wrong. For more information and FAQ see The WebDriver Sampler: Your Top 10 Questions Answered guide.

    ReplyDelete