'API Chaining Test'에 해당되는 글 1건

API Chaining Test 란?

Get data from response of one API and refer in another API

 

 

Add requests in Postman and Use env variables to parameterize the value to be referred

 

아래와 같이 Collection, environment, Request 생성

POST Request 생성
GET Request 생성

 

 

Add scripts to fetch value from response of 1st API

bodyData = JSON.parse(responseBody)

value = bodyData.data[2].first_name

console.log(value)

pm.environment.set("Username1", value);

여기서 "value = bodyData.data[2].first_name" 이 부분은 아래를 통해 참고하였다.

 

[JSONPath Finder 관련]

크롬 확장 프로그램 설치 및 실행


확장 프로그램 실행 후 해당 JSON 데이터를 넣으면 아래와 같이 JSONPath를 찾을 수 있다.

 

 

 

Update the fetched value in env variables

Run and validate

아래와 같이 Variables 와 "UpdateUser" Request도 체인으로 업데이트 동작을 확인할 수 있다.

실행 전
실행 후 variables
실행 후 UpdateUser Request

 

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

API Authorization 관련  (0) 2020.08.07
SOAP requests 구동  (0) 2020.08.07
Collection 원격 구동 with URL  (0) 2020.08.06
Data Driven Testing 관련  (0) 2020.08.06
WORKSPACES 관리  (0) 2020.08.06
블로그 이미지

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

,