I'm using Locust for load testing - creating a lot of post requests to a server. Because I need to generate different fields for every request, The best way to do it in my opinion is to read the body from a file, change the relevant fields and send the request.
The problem occurs when I open the file
I see in the Jenkins log that there is a FileNotFound exception - even though I see the file in the git repo from where the Jenkins runs the code.
I tried putting the full path in the with
statement but still got the same exception.
...
with open('postRequest.json', 'r') as jsonFile:
data = json.load(jsonFile)
data["a"] = b
data["x"] = y
data[["something"] = something_else
return json.dumps(data)
Jenkins fails opening the file.
Note : The code works when I don't read the file, but just create a very long JSON string.
Thanks all !! ;)