mardi 31 mars 2020

Performance tests with pytest: how to make delays and receive time info?

please, can anyone help me out on the following task (I'm new to testing API and python)

I have several tests but I need to create various delays (pauses) between requests. The measurement results should be displayed in stdout: for each combination (endpoint, delay between requests) I shoud reflect the 90th percentile of the application response time. How can this be correctly achived with pytest?

For example basic test:

def test_connection():
s = requests.Session()
r = s.get(url, headers=headers)
if r.status_code == 200:
    print('Authorization is successful')
else:
    print('Authorization failed with code:' + r.status_code)

Aucun commentaire:

Enregistrer un commentaire