Contributions
TestSuite setup script not run during load test
Hi, I have some code in my TestSuite setup script which I'd like executed before running the rest of the test. The code declares some common variables and adds them to the context so that these variables are visible to all the threads that are executing my test cases. The problem I"m running into is that the setup script is not being run if I press the "play" button of the load test. I see that the setup script has its own "play" button and if I push that, I can see it execute and add the variable I want to the context, but it seems that by the time the script ends, the variable goes out of scope. Is there something I need to do to force this TestSuite setup script to execute first when I push the play button of the load test? I'm using the SoapUI GUI instead of running from the command line.814Views0likes1CommentIssue testing asynchronous web-service
I'm running a multi-threaded load test using SoapUI open source edition. I'm testing an asynchronous web-service. I send requests to the service via SoapUI, these requests are queued for later execution, and the web service sends notification responses later. I'm using a MockService to capture these notification responses. I now need a way of mapping each response back to the request that SoapUI originally sent out so that the latency from request to response can be tracked. To do this, I was going to define a ConcurrentHashMap. The test step that sends a request would update the hashmap with the request id and current time. When my MockService receives a notification response it would access the hashmap to get the start time of that request id. The problem I'm facing is that I would need to declare the hashmap in a scope where all the threads access the same hashmap and the MockService also has access to it. If I declare my hashmap in a groovy test step, then each thread when executing the test step would create its own copy of it, which is not what I want. My question is whether there is a way in SoapUI to declare my hashmap at a "global" scope so that all the test threads (and my MockService) can access the same hashmap instance? I tried declaring it in the setup script of the TestSuite and adding it to the TestSuite context but that doesn't seem to be working. Can someone help with this?975Views0likes1CommentRe: sharing a variable across multiple threads in a load test
Quick update. I tried defining the hashmap inside my loadtest set up script and then accessing it in the test case, but this isn't working yet. In my loadtest setup script I have the following: import java.util.concurrent.ConcurrentHashMap ConcurrentHashMap hashmap= new ConcurrentHashMap(); hashmap.put("asdfsdfd", 2000) context["stringtointmap"] = hashmap; In a test step groovy script, I'm trying to write to this hashmap as follows: ConcurrentHashMap hashmap= context.LoadTestContext["stringtointmap"]; hashmap.put("asdfdf", 2343) When I run this I get an error "Cannot invoke method put on a null object" Can someone explain teh proper way to do this?1.4KViews0likes2Commentssharing a variable across multiple threads in a load test
Hi, I'm using SoapUI free edition to run a multithreaded load test. I would like to define a single data structure (e.g., aConcurrentHashMap) that all the test threads access. If I define this in a test step (as a Groovy script), then each individual thread would create a separate copy of the HashMap, whereas I want each thread to access the same HashMap. Is there any way I can define the HashMap in a global or testsuite scope so that its visible to all the threads?1.4KViews0likes3Comments