0

I'm using The Grinder - version 3.7.1 for load testing. My test involves hitting a million urls of this format :

eg: www.someDomain.com/a_1.com www.someDomain.com/a_2.com

SO, if i use The Grinder as such, each process is taking a url, which is not feasible in my case. So, I wanted each thread to take up a url. But, i'm not knowing how to achieve this in grinder.

1 Answers1

0

You can dynamically construct the url in your grinder script. Just use standard python string replacement techniques. Your solution may look something like this:

    from net.grinder.script.Grinder import grinder
    from net.grinder.script import Test
    from net.grinder.plugin.http import HTTPRequest

    test1 = Test(1, "Request resource")
    request1 = test1.wrap(HTTPRequest())

    class TestRunner:

        def _get_url(self):
            url = ""
            # build your url here
            # ...
            return url

        def __call__(self):
            result = request1.GET(self._get_url())

Here are some other example scripts that might be helpful:

http://grinder.sourceforge.net/g3/script-gallery.html

You could read the URLs in from a data file, or build them on the fly. The Grinder API gives you access to the thread number and iteration, potentially useful to your task.

Travis Bear
  • 13,039
  • 7
  • 42
  • 51
  • Hi Travis, I tried reading urls from a file. But one thread does not take up a url. One process takes up a url. And can I get the thread number and manually assign urls to it? – priya_satagopan Mar 29 '12 at 07:07
  • There is no strict coupling between threads, processes, or urls. You cold assign an arbitrary number of urls to each thread. You could even go so far as to have a unique url for each iteration of each thread. Python has a rich set of string-manipulation techniques that you can use to this end. You can get information on your current thread by accessing grinder.threadNumber and grinder.runNumber. See the script gallery (linked in the answer) for examples on how to do this. – Travis Bear Mar 29 '12 at 18:24
  • okay, thanks. I was also looking at other load testing engines and found it easier using JMeter. But I will also try like how you said in Grinder. – priya_satagopan Apr 02 '12 at 09:16