'WEB API Test'에 해당되는 글 15건

Note - if you provide authorization at collection or folder level, In the request authorization, Select - "Inherit auth from parent"

When you add Authorization, some headers get added in the request, You can check by going to Headers tab and view hidden Headers

 

 

Search "github rest api on google" and Create Request Items

GitHub Repository를 생성하는 리퀘스트를 생성할 예정!

URL 참고 내역

https://developer.github.com/v3/

 

GitHub API v3

Get started with one of our guides, or jump straight into the API documentation.

developer.github.com

https://developer.github.com/v3/ 페이지 참고 부분

 

Endpoint 참고 내역

https://developer.github.com/v3/repos/

 

Repositories

Get started with one of our guides, or jump straight into the API documentation.

developer.github.com

https://developer.github.com/v3/repos/ 페이지 참고 부분
https://developer.github.com/v3/repos/ 페이지 참고 부분

 

아래와 같이 리퀘스트 생성!

{
    "name": "Hello-World Github",
    "description": "This is your first repository",
    "homepage": "https://github.com",
    "private": false,
    "has_issues": true,
    "has_projects": true,
    "has_wiki": true
}

 

 

Setting Request

Authorization > TYPE:Bearer Token > 아래 URL에서 생성한 토큰 입력

 

Github(로그인)접속 > Settings > Developer settings > Personal access tokens > Generate new token 클릭 > Select scopes에서 "repo" 부분만 클릭 > "Note" 에 토큰 이름 입력 후 생성

 

해당 토큰은 바로 입력 할 수 있지만 아래와 같이 변수 처리 할 수있다

Environment에서 해당 토큰을 변수처리함

 

 

Run

Postman 확인
github 확인

 

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

API Chaining Test 관련  (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
블로그 이미지

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

,

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
블로그 이미지

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

,

사전 작업

크롬 확장 프로그램 설치

 

 

Get Soap request url or WSDL url add to request url

아래 예제 URL을 참고하여 등록

http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL

 

 

Set method as POST

위의 URL 복사해서 아래와 같이 복붙

 

 

Set body as raw and set text/xml

 

 

Provide request data in body

위의 페이지에서 크롬 확장 프로그램 실행 후 아래와 같이 클릭

 

클릭하면 아래와 같이 해당 데이터가 나옴

 

아래와 같이 복사 붙여넣기

 

 

Run and validate

테스트 관련 코드를 "Tests"탭에 추가 후 구동!

 

Pubilc Link를 통해서도 테스트가 가능하다

C:\Users\toast>newman run https://www.getpostman.com/collections/600d1b0f5374e88fed46
newman

SOAP Collection

→ http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL
  POST http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL ――[200 OK, 564B, 684ms]
  √  Status code is 200

┌─────────────────────────┬────────────────────┬───────────────────┐
│                         │           executed │            failed │
├─────────────────────────┼────────────────────┼───────────────────┤
│              iterations │                  1 │                 0 │
├─────────────────────────┼────────────────────┼───────────────────┤
│                requests │                  1 │                 0 │
├─────────────────────────┼────────────────────┼───────────────────┤
│            test-scripts │                  1 │                 0 │
├─────────────────────────┼────────────────────┼───────────────────┤
│      prerequest-scripts │                  0 │                 0 │
├─────────────────────────┼────────────────────┼───────────────────┤
│              assertions │                  1 │                 0 │
├─────────────────────────┴────────────────────┴───────────────────┤
│ total run duration: 849ms                                        │
├──────────────────────────────────────────────────────────────────┤
│ total data received: 311B (approx)                               │
├──────────────────────────────────────────────────────────────────┤
│ average response time: 684ms [min: 684ms, max: 684ms, s.d.: 0µs] │

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

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

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

,

Get your collection url

Collection > Share > Get pubilc link > Get public link 클릭 후 해당 URL 복사

 

 

Get Newman and run with command

newman run "url"

 

실행 화면

 

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

API Chaining Test 관련  (0) 2020.08.07
SOAP requests 구동  (0) 2020.08.07
Data Driven Testing 관련  (0) 2020.08.06
WORKSPACES 관리  (0) 2020.08.06
Newman 관련  (0) 2020.08.06
블로그 이미지

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

,

Data variables can be used wherever environment variables can be used except in pre-request and test scripts

 

 

사전 작업

Request 생성

 

Tests 탭에는 아래와 같이 작성

tests["Contains email"] = responseBody.has(data.email);

tests["Contains password"] = responseBody.has(data["password"]);

 

 

Get data from csv, json file

csv, json 파일을 아래와 같이 불러오고, "Preview"를 통하여 데이터를 미리 확인할 수 있다

 

 

Run data-driven Tests

실행을 누르면 아래와 같이 테스트 결과와 csv, json 파일을 불러온 것을 확인할 수 있다.

 

테스트 데이터

data1.csv
0.00MB
data2.json
0.00MB

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

SOAP requests 구동  (0) 2020.08.07
Collection 원격 구동 with URL  (0) 2020.08.06
WORKSPACES 관리  (0) 2020.08.06
Newman 관련  (0) 2020.08.06
Tests 생성(Quick Scripts 활용)  (0) 2020.08.06
블로그 이미지

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

,

workspace란?

Workspace is an area where you can group, organize and manage your collections

 

 

Workspaces are available from Postman 6.0 ver

 

 

Create and Manage workspace

 

 

Share collections in workspaces

하단에 "Browse" 클릭

 

오른쪽 상단에 "Add to workspace" 클릭

 

 

Remove a collection from workspace

 

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

Collection 원격 구동 with URL  (0) 2020.08.06
Data Driven Testing 관련  (0) 2020.08.06
Newman 관련  (0) 2020.08.06
Tests 생성(Quick Scripts 활용)  (0) 2020.08.06
Environment 생성 및 활용  (0) 2020.08.06
블로그 이미지

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

,

Newman 은 Postman의 Collection을 커맨드 라인에서 실행시켜준다!

 

 

전체적인 순서

1. Install node.js

2. Install newman

3. export collection and run from commandline

4. On cmd goto location of collection json file

5. Run command

 

 

check if node.js is already installed

cmd 창에서 아래와 같이 확인

node -v  
npm -v

 

 

1. Install node.js

만약 설치가 안되어있다면 아래 URL 참고하여 설치

https://nodejs.org/en/download/

 

Download | Node.js

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

nodejs.org

 

 

2. Install Newman

cmd 창에서 아래 명령어로 뉴맨 설치!

npm install -g newman

 

 

3. Export collection as json file

 

 

4. On cmd goto location of collection json file

5. Run command

예시 : newman run (exprot한 json 파일 명)

newman run collectionfilename.json

 

 

실행 화면

C:\Users\toast\Desktop\Postman>newman run Collection1.postman_collection.json
newman

Collection1

□ GET
└ GET User
  ┌
  │ 'Hello world...'
  │ 'Value for url variables is : https://reqres.in'
  │ 'POSTMAN'
  │ undefined
  └
  GET https://reqres.in/api/users/2  [200 OK, 1.08KB, 249ms]
  ┌
  │ 'Hello world...'
  │ 'Value for url variables is : https://reqres.in'
  │ 'POSTMAN'
  │ undefined
  └

└ GET UserList
  ┌
  │ 'Hello world...'
  │ 'Value for url variables is : https://reqres.in'
  │ 'POSTMAN'
  │ undefined
  └
  GET https://reqres.in/api/users?page=2 [200 OK, 1.78KB, 47ms]
  √  Verify Response time is less than 200ms
  √  Verify Status code is 200

└ ScriptsTest
  ┌
  │ 'Hello world...'
  │ 'Value for url variables is : https://reqres.in'
  │ 'POSTMAN'
  │ undefined
  └
  GET  [errored]
     runtime:extenstions~request: request url is empty

□ POST
└ User Registration
  ┌
  │ 'Hello world...'
  │ 'Value for url variables is : https://reqres.in'
  │ 'POSTMAN'
  │ undefined
  └
  GET  [errored]
     runtime:extenstions~request: request url is empty

┌─────────────────────────┬────────────────────┬────────────────────┐
│                         │           executed │             failed │
├─────────────────────────┼────────────────────┼────────────────────┤
│              iterations │                  1 │                  0 │
├─────────────────────────┼────────────────────┼────────────────────┤
│                requests │                  4 │                  2 │
├─────────────────────────┼────────────────────┼────────────────────┤
│            test-scripts │                  6 │                  0 │
├─────────────────────────┼────────────────────┼────────────────────┤
│      prerequest-scripts │                  5 │                  0 │
├─────────────────────────┼────────────────────┼────────────────────┤
│              assertions │                  2 │                  0 │
├─────────────────────────┴────────────────────┴────────────────────┤
│ total run duration: 729ms                                         │
├───────────────────────────────────────────────────────────────────┤
│ total data received: 1.58KB (approx)                              │
├───────────────────────────────────────────────────────────────────┤
│ average response time: 148ms [min: 47ms, max: 249ms, s.d.: 101ms] │
└───────────────────────────────────────────────────────────────────┘

  #  failure           detail

 1.  Error             runtime:extenstions~request: request url is empty
                       at request
                       inside "GET / ScriptsTest"

 2.  Error             runtime:extenstions~request: request url is empty
                       at request
                       inside "POST / User Registration"

 

 

Jenkins 활용 관련

아래와 같이 Newman 명령어로 JOB 생성하여 진행

 

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

Data Driven Testing 관련  (0) 2020.08.06
WORKSPACES 관리  (0) 2020.08.06
Tests 생성(Quick Scripts 활용)  (0) 2020.08.06
Environment 생성 및 활용  (0) 2020.08.06
VARIABLES 활용  (0) 2020.08.06
블로그 이미지

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

,

Snippets 란?

script templates

 

아래와 같이 해당 항목들을 클릭하면 자동으로 생성!

 

 

 

Postman tests are javascript code that is executed after receiving the response

 

 

Create tests at REQUEST & FOLDER & COLLECTION level

Request level

 

Folder level

 

Collcection level

 

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

WORKSPACES 관리  (0) 2020.08.06
Newman 관련  (0) 2020.08.06
Environment 생성 및 활용  (0) 2020.08.06
VARIABLES 활용  (0) 2020.08.06
VARIABLES 생성  (0) 2020.08.06
블로그 이미지

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

,