Run test scripts in parallel in nGrinder

839 views Asked by At

We are running performance tests with nGrinder. We have use cases where we would desire to run multiple test scripts in parallel.

On their website it is stated that one user can only run one test at a time. So we setup two users but I see the same behavior: only one test script is running and the others are waiting in a READY state.

Is there any way in nGrinder to run multiple test scripts in parallel?

2

There are 2 answers

5
JunHo Yoon On

It's only possible to run multiple test concurrently when these tests are submitted to execute by the different users if the free agents are available enough to run both tests.

I'm suspecting you don't have enough agents to run both.

0
user666 On

You can run many scripts using one agent only . I would divide agents based on transaction groups and not on scripts.

Inside grinder there is parallel.py .I have used this only before to run scripts in parallel.

See this link https://github.com/DealerDotCom/grinder/blob/master/grinder/examples/parallel.py

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()