Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

314
Vistas
Trigger a New Request if a Test fails in Postman (CollectionVariable?)

I'd like to trigger a new request automatically if a postman test fails. Currently, in each request I have about 30 tests running based on what I'm expecting in the request's response. Test Example:

pm.test("YES",() => {
    var yes = pm.response.json().eligibility_results.filter(obj => {
        return obj.benefit == "YES" 
    })
  pm.expect(yes[0].result).to.eql("eligible")
});

Now, If anything else other than the string "eligible" results for this object, the test will fail. I'd like to write a script that tells postman if one of the 30 tests come back as a failure (not expected) a new request will automatically be initiated.

I've tried:

    pm.test("Check for failures", () => {
    if (pm.expect().not.eql("")) {
        (pm.sendRequest("New Request"))
    }
    else {
        pm.sendRequest(null)
        
    }
})

Also tried:

pm.test("Check for failures", () => {
    if (pm.expect(pm.response.result()).not.eql) {
        (pm.sendRequest("New Request"))
    }
    else {
        pm.sendRequest(null)
        
    }
})

I seem to be missing something here. The tests are giving me a PASS in the Test Results but it isn't initiating a new separate request. Any options?

Maybe a Post-Request if there is such a thing...

Any help greatly appreciated.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda