Last active
March 30, 2021 00:48
-
-
Save kaiomagalhaes/b82fabd764987967a0b4eba312e752a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1000 ms is a maximum allowed value according to requirements | |
maximumResponseTime = 1000; | |
//100 is a number of sent requests according to requirements | |
iterations = 800; | |
//100 ms is a delay between requests according to requirements | |
//responseTimes is an array for collecting response time values | |
responseTimes = []; | |
i = 0; | |
while (i < iterations) { | |
i++; | |
sendRequest() | |
} | |
function sendRequest() { | |
pm.sendRequest({ | |
url: "https://demo.mytimein.com/rainfall/tracking/UploadApplications", | |
method: 'POST', | |
body: { | |
mode: 'raw', | |
raw: JSON.stringify({ | |
"job_id": 259, | |
"applications": [ | |
{ | |
"window_title": "Facebook", | |
"application_name": "Brave Browser", | |
"url": "https://getemoji.com", | |
"seconds": 500 | |
} | |
] | |
}) | |
}, | |
header: 'token: <TOKEN>', | |
}, function (err, res) { | |
pm.test("Response time is " + res.responseTime, function () { | |
pm.expect(err).to.equal(null); | |
pm.expect(res).to.have.property('code', 200); | |
responseTimes.push(res.responseTime); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment