'분류 전체보기'에 해당되는 글 33건

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

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

,

What is Environment?

Env is a set of key-value pairs

 

 

선행 작업

아래 URL 참고하여 POST Requset 생성

https://reqres.in/

 

Reqres - A hosted REST-API ready to respond to your AJAX requests

Native JavaScript If you've already got your own application entities, ie. "products", you can send them in the endpoint URL, like so: var xhr = new XMLHttpRequest(); xhr.open("GET", "https://reqres.in/api/products/3", true); xhr.onload = function(){ conso

reqres.in

 

Body 작업(아래 Json 형식의 데이터는 위의 페이지에서 확인)

{
	"email": "{{email}}",
	"password": "{{pasword}}"
}

 

 

Create Environment

MANAGE ENVIROMENTS > Add 클릭

 

 

Use Environment

변수 사용 예 : {{변수명}}

 

 

결과 콘솔 화면

 

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

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

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

,

사전 설정

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

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

,

variables란?

elements(data store) that can take different values

 

사용하는 이유?

to reuse values at multiple places
avoid repetition
to avoid re-work when value changes

 

Create variables

Collection 안에 Variadbles 설정

 

Refer variables

예시 : {{변수명}}

 

 

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

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

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

,

Create request

 

 

Run request

 

 

Collection Runner 창 확인

 

 

테스트를 위해 아래와 같이 세팅 후 Run Collection1 버튼 클릭

 

 

실행 완료 화면

 

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

VARIABLES 활용  (0) 2020.08.06
VARIABLES 생성  (0) 2020.08.06
Collection 생성  (0) 2020.08.06
Request 구동  (0) 2020.08.06
API Request 생성  (0) 2020.08.06
블로그 이미지

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

,

COLLECTION 이란?

Grouping requests in collections

 

 

Create Collection

아래와 같이 Collection을 생성할 수 있다.

 

생성된 화면

 

 

Create folders inside collection

collection 안에 아래처럼 폴더를 생성하여 세부 그룹을 지정할 수 있다

Share, Run은 다음에 설명

 

폴더 생성 확인

 

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

VARIABLES 활용  (0) 2020.08.06
VARIABLES 생성  (0) 2020.08.06
Collection 구동  (0) 2020.08.06
Request 구동  (0) 2020.08.06
API Request 생성  (0) 2020.08.06
블로그 이미지

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

,