I hava a collection with tests A, B, C, D, E, F. The test D must be executed several times, so it will execute A, B, C, D, D, D, D, E, F.
I followed the trick like this :
const currentTest = âDâ;
const nextTest = âEâ;const entity = JSON.parse(pm.collectionVariables.get(âcurrentEntityâ));
pm.test(Testing D with entity ${entity} status code is 202
, () => {
pm.response.to.have.status(202);
});let entities = pm.collectionVariables.get(âentitiesâ);
if(entities) { entities = JSON.parse(entities); }
if (entities && entities.length > 0){
postman.setNextRequest(currentTest);
} else {
postman.setNextRequest(nextTest);
}
I would like to know if it was possible to dynamically get the name of the current test (D) and the name of the next test (E).
The goal is to be able to change the workflow without having to change âcurrentTestâ and ânextTestâ and making errors.
I saw âsetNextRequestâ, is there is a way to have something like âgetCurrentRequestâ and âgetNextRequestâ ?
Thank you community,
See you,
Kin