0

We have developed selenium webdriver script with junit+java using eclipse on window 7. All the scripts are working as expected now we are using this script for load testing using Jmeter. However, while running script system open multiple browser (200) based on user thread and it create system to hang, is there any way to handle this or we can run script without opening browser. I have come across xvfb tool, but not able to get java api for this tool to plugin in eclipse.

We have also tried using HtmlUnitDriver but as it does not support javascript hence the test is getting failed, also we tried HtmlUnit and found same thing.

Note: that we have writen webdriver script to maintain display item of element (autocomplete, image) on screen.

It would be great if anyone can help or provide more inputs on this...

Karim Narsindani
  • 434
  • 3
  • 14
  • 38

1 Answers1

0

Firstly, do not integrate selenium scripts with JMeter for load testing! It's not a good approach to follow due to the obvious consequences that you have mentioned in your post. I followed a similar apporach in the beginning when I was new to JMeter and selenium but suffered a great deal when it came to running load tests that spawned too many browser instances which killed the OS.

You can go for HtmlUnitDriver or any headless browser testing tools out there with JMeter, but still, they will be running the browser internally in the memory. Moreover if your application is heavily using Javascript, it won't help.

So I would suggest that you record a browsing session with JMeter Proxy and modify the script (set of requests) according to your needs and play those requests alone, with number of threads.

From a higher level, you should be doing this:

  1. Add a JMeter test plan, listeners, thread group and setup JMeter proxy and record a browsing session where you enter something into the autocomplete textbox and you get certain results.
  2. Stop your proxy and take a look at all the requests that come under your thread group.

  3. As far as I know, when it comes to autocomplete plugins, multiple requests are sent everytime you enter a letter into the textbox. For example, for the word 'stackoverflow':

    Request1: q=s
    Request2: q=st
    Request3: q=sta
    and so on

    Here you can simulate this effect by including words such that all words have the same length which in turn will let you have same number of requests to be sent to the server.

  4. So in your test plan, you will pass one word per Jmeter thread. You can pass the words to a request, from a csv file by using jmeter parametrization.

This will be a much memory efficient way of load testing instead of using selenium with JMeter. I had asked a similar question. You can check out the responses.

Community
  • 1
  • 1
Abhijeet Vaikar
  • 1,578
  • 4
  • 27
  • 50
  • I agree with you, however even I have tried using jmeter for load testing, but we have to select option from auto complete drop down and this create problem running jmeter script. I have tried and search on net but did not find any solution hence, i end up with selenium. Also, I am new to jmeter don't know how to use its regex or set parameter for posting data. Do you have any link where I can get more information about using jmeter with example or do you have sample jmeter script for clicking option from auto complete drop down. – Karim Narsindani Mar 12 '14 at 09:49
  • The action of clicking option from auto-complete drop-down involves a server request right? – Abhijeet Vaikar Mar 12 '14 at 09:51
  • Yes, it is... In our application we select option from auto complete drop down and than system load other elements on page. I have tried sending value in parameter, like 'elementid' from web page and setting it in jmeter with value but did not worked... – Karim Narsindani Mar 12 '14 at 09:55
  • If my answer helps, do consider upvoting it or accepting it. – Abhijeet Vaikar Mar 12 '14 at 11:54
  • Well, I have tried the details given by you, however it help me bit to move forward. Problem I am facing in jmeter is that, after selecting option from auto complete, it create dynamic order number let say <123456>, this number is getting encrypted let say and it appended to url. Now, script which I have recorded has the encrypted value based on number while recording script and now when I run this recoded script it does not get the new encrypted value and it keeps working on same order placed by user. Is there any way we can get this encrypted value in jmeter script? – Karim Narsindani Mar 12 '14 at 14:05