Forum Discussion
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?
- nmrao11 years ago
Champion Level 1
What I believe is that even setup script gets executed in each test run. And each time a new ConcurrentHasMap is getting created in this case. May be you can control the entire test execution from the groovy itself to avoid that which includes running of loadTest, this is what it comes to my head. May be there could be other ways too.- nmrao11 years ago
Champion Level 1
Looks like you opened duplicate topic
I would suggest to continue with one thread please, just think of other people time as well. If someone knows answer, anyway he/she replies your question. Strongly discourage to open duplicates(at least of your own). Every question/query always do not take same time to respond, some may be peculiar, need more time to respond for the people on the forum, before that the question needs to be understood with the provided information. Also I understand you were in hurry with your work, but the same is case for others. Please be patient and thank you. Now onwards, please do followup on other thread.