Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
Uso de IF/ELSE en secuencias de comandos de Postman Test

Estoy usando Postman para probar, pero estoy atascado usando if/else en los scripts.

Mi objetivo es probar si una propiedad es visible en el cuerpo de la respuesta. si la propiedad no está allí, quiero que el cartero espere que esté vacía. y pasar a la siguiente prueba. Las propiedades están anidadas en una matriz.

Esto es lo que se me ocurrió hasta ahora.:

 //Test of correct sub properties rijbewijs zijn meegestuurd pm.test("Test if correct sub properties rijbewijs are sent", () => { if (pm.expect(matchesVacatures.rijbewijs).to.be.empty); else { pm.expect(matchesRijbewijs).to.have.property('codeSoortRijbewijs');} });

Sin embargo, la prueba siempre "falla" si la matriz no está vacía. ¿Cómo hago esto? Puede ser algo pequeño que coloqué incorrectamente en la prueba, pero no puedo resolverlo.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Lo averigué:

 pm.test("Test if correct sub properties rijbewijs are sent", () => { if ((matchesVacatures.rijbewijs).length !== 0) {pm.expect(matchesVacatures.rijbewijs[0]).to.have.property('codeSoortRijbewijs');}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!