0

I want to store data for later use in the locust, for example

response = self.client.post('/' "username:'xx', password:"xx")
self.client.data1 = response.content['data1']    

self.client.data1 can be used in the next request, but when simulate more, the self.client.data1 get lost. Is there a better way to store data for later use?

  • why don't you use a dict to store the data there? – Leo Jun 30 '15 at 10:54
  • I highly doubt Locust would have some methods to do this for you when you can easily do this using Python. You could store the data in an object, a database, a dictionary, a list, a JSON text file, etc. all depending on what kind of data it is and how you plan on reusing it. It might help you to think like this - _"If I were just writing Python code, how would I store data?"_ – Anish Ramaswamy Aug 28 '15 at 23:51
  • Why does self.client.data1 get lost when simulating more? – Brian Aug 09 '16 at 08:35
  • I didn't experience this phenomenon when testing with locust. – Brian Aug 09 '16 at 08:41

0 Answers0