-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEjecutar pre-request
More file actions
27 lines (16 loc) · 863 Bytes
/
Copy pathEjecutar pre-request
File metadata and controls
27 lines (16 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
VAMOS A GUARDAR EN UNA VARIABLE DE NUESTRO ENTORNO LA FECHA EN LA QUE ESTAMOS ACTUALMENTE
VAMOS A AUTOMATIZAR SIENTO LA FECHA LA DE HOY,
VAMOS A LA PESTAÑA DE PRE-REQUEST SCRIPT
//Guardar en el enviroment el dia de hoy
pm.enviroment.set("today", new DATE().toIOString())
le damos al ojo donde esta las variables de entorno.
Aparecerá una nueva variable llamada today
Vamos para la pestaña (Params)
KEY VALUE DESCRIPTION
begin_date | {{today}}
Esto es ejecutar codigo antes de hacer un llamado utlizando pre-request script
Para mantener actualizado el token dentro de una variable para que cuando montemos un ticket, todos los endpoints
que tengan la variable seteada esten actualizados, se hace en Test
primero hay que parsear la variable json
var json = JSON.parse(responseBody);
postman.setEnvironmentVariable("token", 'Token ${json.token}')