My question: I have put a code in the Pre-request Script for a Collection in Postman. The purpose of this code is to automatically generate a new token, for the whole Collection, when the token expires. But afterwards, when using “htmlextra” to generate a Newman report, after executing the Collection, the number of “Total Requests” and “Total Failed Tests” gets doubled up. Somebody wrote about this problem two year ago. Has there been found a solution to this problem been yet?
This is the part of the code that (apparently) causes the problem:
pm.sendRequest(getTokenRequest, (err, response) => {
const jsonResponse = response.json();
const newAccessToken = jsonResponse.access_token;
pm.variables.set('access_token', newAccessToken);
});