chihhsiw
14 years agoOccasional Contributor
How to control number of load test thread through script
Hi,
I'm doing load test on my testcase in multi thread mode and trying to control the number of thread through input file
I have input file with content <ThreadCount>3</ThreadCount>
Then I have setup script in testcase like
File readFile = new File("input_file.txt")
Filecontent = readFile.getText()
gutils = new com.eviware.soapui.support.GroovyUtils( context )
InputXML = gutils.getXmlHolder(Filecontent)
threadCount = InputXML.getNodeValue( "//ThreadCount")
// dynamically configuring number of thread
if( context.LoadTestRunner!= null )
{
synchronized(context.LoadTestContext.lock)
{
LoadTestRunner2 = context.LoadTestRunner
// threadCount = 3
LoadTestRunner2.loadTest.threadCount = threadCount
}
}
and a groovy script like
context.logger.println "In groovy thread count is " + context.LoadTestRunner.threadCount
context.logger.println "In groovy step thread idex is " + context.ThreadIndex
then with another wsdl test step
For this load test, I try to use LoadTestRunner2.loadTest.threadCount = threadCount
to set threadCount from input file and control number of thread but the number of thread always jump from 3 to 49 after 1st thread runs
(the weird thing is if I do LoadTestRunner2.loadTest.threadCount = 3 or threadCount = 3 and LoadTestRunner2.loadTest.threadCount = threadCount, the threadCount always stay as 3)
I guess I need to set run mode to SINGLETON_AND_WAIT in script based on viewtopic.php?f=5&t=7953&p=23081&hilit=runmode&sid=2dccc924bbfba37bf0f08dee99de90e3#p23081
but I haven't found a way to do it in script.
Can anyone give me idea about how to do it or how to solve my problem?
thanks
chihhsiw
I'm doing load test on my testcase in multi thread mode and trying to control the number of thread through input file
I have input file with content <ThreadCount>3</ThreadCount>
Then I have setup script in testcase like
File readFile = new File("input_file.txt")
Filecontent = readFile.getText()
gutils = new com.eviware.soapui.support.GroovyUtils( context )
InputXML = gutils.getXmlHolder(Filecontent)
threadCount = InputXML.getNodeValue( "//ThreadCount")
// dynamically configuring number of thread
if( context.LoadTestRunner!= null )
{
synchronized(context.LoadTestContext.lock)
{
LoadTestRunner2 = context.LoadTestRunner
// threadCount = 3
LoadTestRunner2.loadTest.threadCount = threadCount
}
}
and a groovy script like
context.logger.println "In groovy thread count is " + context.LoadTestRunner.threadCount
context.logger.println "In groovy step thread idex is " + context.ThreadIndex
then with another wsdl test step
For this load test, I try to use LoadTestRunner2.loadTest.threadCount = threadCount
to set threadCount from input file and control number of thread but the number of thread always jump from 3 to 49 after 1st thread runs
(the weird thing is if I do LoadTestRunner2.loadTest.threadCount = 3 or threadCount = 3 and LoadTestRunner2.loadTest.threadCount = threadCount, the threadCount always stay as 3)
I guess I need to set run mode to SINGLETON_AND_WAIT in script based on viewtopic.php?f=5&t=7953&p=23081&hilit=runmode&sid=2dccc924bbfba37bf0f08dee99de90e3#p23081
but I haven't found a way to do it in script.
Can anyone give me idea about how to do it or how to solve my problem?
thanks
chihhsiw