'Pre-request Script'에 해당되는 글 1건

사전 설정

settings 화면

 

 

How to get & set variables through scripts

[Test 탭 스크립트 작성]
[Pre-request Scripts 탭 스크립트 작성]

console.log("Hello world..."); 

let urlVar = pm.variables.get("url");
console.log("Value for url variables is : "+urlVar);

pm.variables.set("name", "POSTMAN");

console.log(pm.variables.get("name"));

let globalVar = pm.globals.get("Env");

console.log(globalVar);

 

관련 스크립트 방법은 아래 URL 참고

https://learning.postman.com/docs/writing-scripts/script-references/test-examples/

 

Home

Postman Learning Center Learn how to use Postman effectively in your API projects. Check out the docs and support resources! Explore the docs

learning.postman.com

 

 

실행 후 콘솔 화면

 

'WEB API Test > Postman' 카테고리의 다른 글

Tests 생성(Quick Scripts 활용)  (0) 2020.08.06
Environment 생성 및 활용  (0) 2020.08.06
VARIABLES 생성  (0) 2020.08.06
Collection 구동  (0) 2020.08.06
Collection 생성  (0) 2020.08.06
블로그 이미지

정신차려이각박한세상속에서

,