API Bloom is a weekly prize-winning challenge in the Ready! API Community. Each week, we assign a task that you need to accomplish to become a winner. See the rules here.
THIS WEEK TASK
Give the biggest number of Solutions on the Ready! API forums
Top 3 contributors will get $50, $35, and $15 gift cards!
03-20-2017 02:34 PM
I am creating a Load Test using the com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTest class in my Java project. When I run the loadTest it works, and the endpoint does what it is supposed to do to a member. The thing is I need each thread to be a different member.
Here I go into my TestSuite, and then into my testCase. I set the propertyValue of the testCase.
WsdlTestSuite testSuite = testProject.getTestSuiteByName("Reward");
WsdlTestCase testCase = testSuite.getTestCaseByName("TriggerActivityReward");
The testStep gets the data of the memberId from the testCase property "memberId". As such:
In the JSON of the POST rest endpoint.
Then I setUp my loadTest.
loadTest = testCase.addNewLoadTest("firstLoadTest");
I need each thread to have a different memberId every run. How could I achieve this? I have gone through the documentation of the com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTest class, and I haven't found much. I also so something like context.ThreadIndex by adding a setUp groovy script to the loadTest. I tried that but didn't work.
Any thoughts? Ideas?
Solved! Go to Solution.
03-21-2017 03:39 AM - edited 03-21-2017 03:40 AM
Change from :
03-21-2017 05:33 AM
Thanks for your response Rao. The thing is I have an array lets say with 100 memberIDs, those are the memberIDs I need to use, they can't just be random numbers. Inside my JSON I also have a groupID which is the group that memberID is part of. I also have another array with the groupIDs I need to use.
Is there anyway to get every thread, and change the properties of the TestCase just before a thread ("user") is created for the Load Test?
03-21-2017 05:43 AM - edited 03-21-2017 07:27 AM
Then you can define the list with valid values in a groovy script before json request step
def list = [12343, 12345, 342432,3432,32131]
def index = new Random().nextInt(list.size())
03-21-2017 06:00 AM
Hi Rao, Thank you so much for your help! Is this script a setUp script for the LoadTest or a script for the TestStep?
Thank you again!
03-21-2017 07:26 AM