Re: Running Multiple Scripts Concurrently Using Grinder

Adil qureshi <[email protected]> Tue, 23 Jun 2015 22:20:44 +0100
Newsgroups gmane.comp.java.grinder.user
Message-ID <CAH6ok+Q4zf-FN==W86-XYQibgKbapQKO_gK91d8Ozn_PcQGKLw@mail.gmail.com>
Hi ,

 I have attached it here . You can extend it beyond thread numbers to
adding similar checks on agents ,script names etc  ...

 However you have to code  ;)


 If you download grinder from the website there are many other useful
scripts present in g*rinder-3.11\examples*

On Tue, Jun 23, 2015 at 10:12 PM, Christine Economy <[email protected]
> wrote:

> Hi Adil,
>
> Thanks for your amazingly quick response - I know now that the Grinder
> network
> does respond! (not all tech networks are that good).
>
> I'm using an environment set-up by someone who is not longer at the
> company.
> I've searched for a parallel.py script in al directories, and nothing
> is/was found.
> Possibly, multi-script runs have not been done in this area..
>
> Do you have one that has worked for you?  How does it relate tho the master
> script?  I'm hoping you're right when you say it's pretty easy.  It IS
> pretty easy
> with Loadrunner and JMeter.
>
> I really appreciate your time and help!
>
> Thanks and regards,
> Chris
>
>
>
>
> On Tue, Jun 23, 2015 at 1:59 PM, Adil qureshi <[email protected]> wrote:
>
>> Inside examples go to parallel.py. .I am using the same. .,its quite easy
>> to do that in grinder. ..
>> On 23 Jun 2015 21:55, "Christine Economy" <[email protected]>
>> wrote:
>>
>>> Hi Grinder World Members,
>>>
>>> I'm a performance engineer who has used Loadrunner and QTP
>>> for several years, and have used JMeter a few times as well, but
>>> just started using Grinder.  I've run some large tests, but have not had
>>> to run multiple scripts concurrently until now, and I'm hoping someone
>>> out
>>> will be kind enough to offer some help/guidance.  I have to have this
>>> working
>>> for a super high visibility project in the next one and a half.
>>>
>>> I'm basically looking for an equivalent to Loadrunner's multiple scripts
>>> in a
>>> scenario, or HTTP requests with JMeter.
>>>
>>> I did some homework/Googling before reaching out to you -
>>> and found this helpful link:
>>>
>>> http://osdir.com/ml/java.grinder.user/2004-05/msg00014.html
>>>
>>> Apologies if I'm being dense on this, but I'm not seeing the step by step
>>> thought process; for example, where/how is the divisor (4 in most cases
>>> in the doc
>>> at the link) is being arrived at.  I think just a bit of input from
>>> someone who has done
>>> this will make it clear.
>>>
>>> Also, is anything additional needed along with the master script?
>>>
>>> Thanks very much for your time and help.
>>>
>>> Best regards,
>>> Chris
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Monitor 25 network devices or servers for free with OpManager!
>>> OpManager is web-based network management software that monitors
>>> network devices and physical & virtual servers, alerts via email & sms
>>> for fault. Monitor 25 devices for free with no restriction. Download now
>>> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
>>> _______________________________________________
>>> grinder-use mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/grinder-use
>>>
>>>
>>
>> ------------------------------------------------------------------------------
>> Monitor 25 network devices or servers for free with OpManager!
>> OpManager is web-based network management software that monitors
>> network devices and physical & virtual servers, alerts via email & sms
>> for fault. Monitor 25 devices for free with no restriction. Download now
>> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
>> _______________________________________________
>> grinder-use mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/grinder-use
>>
>>
>
>
> ------------------------------------------------------------------------------
> Monitor 25 network devices or servers for free with OpManager!
> OpManager is web-based network management software that monitors
> network devices and physical & virtual servers, alerts via email & sms
> for fault. Monitor 25 devices for free with no restriction. Download now
> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
> _______________________________________________
> grinder-use mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/grinder-use
>
>

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o

_______________________________________________
grinder-use mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/grinder-use
parallel.py (text/plain, 850 B)
# Run test scripts in parallel
#
# Run TestScript1 in 50% of threads, TestScript2 in 25% of threads,
# and TestScript3 in 25% of threads.

from net.grinder.script.Grinder import grinder

scripts = ["TestScript1", "TestScript2", "TestScript3"]

# Ensure modules are initialised in the process thread.
for script in scripts: exec("import %s" % script)

def createTestRunner(script):
    exec("x = %s.TestRunner()" % script)
    return x

class TestRunner:
    def __init__(self):
        tid = grinder.threadNumber

        if tid % 4 == 2:
            self.testRunner = createTestRunner(scripts[1])
        elif tid % 4 == 3:
            self.testRunner = createTestRunner(scripts[2])
        else:
            self.testRunner = createTestRunner(scripts[0])

    # This method is called for every run.
    def __call__(self):
        self.testRunner()