Automation/Postman

Tests

c29130811 2020. 9. 22. 23:31

javascript를 수동으로 입력하거나, Snippets를 이용하여 여러 기능을 사용할 수 있다. 

상단의 스크린 샷 처럼, Response의 Status가 200인지 체크 후, Test Results에 결과를 보여준다. 

또한 Postman에서 제공되는 pm 객체를 통해 다양하게 사용할 수 있다.

 

주로 사용하는 것은,

 

응답 값 체크 

pm.test("Status code is 200", function () { pm.response.to.have.status(200); });

 

응답 값을 저장하여 사용

pm.environment.set("access_token", pm.response.json().access_token)

 

응답 체크 (Response time, 또는 String, Number 등 타입까지 )

pm.test("Status code is 200", () => { pm.expect(pm.response.code).to.eql(200); });

 

자세한 내용

learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#scripting-with-environment-variables

 

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

728x90

'Automation > Postman' 카테고리의 다른 글

Postman Flows  (0) 2023.04.28
Postman - new man  (0) 2023.02.18
Postman - validation  (0) 2023.02.18
Environment  (0) 2020.09.23
Postman  (0) 2020.09.22