0

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 !! ;)

Tupteq
  • 2,986
  • 1
  • 21
  • 30
Raziv
  • 59
  • 5

1 Answers1

0

The issue was resolved, in the Jenkins the full path is different than I thought it was. Anyway, ran pwd and saw where I was - added the path where the file was and worked.

Thanks friends !

Raziv
  • 59
  • 5