postman + newman + jenkins (win system, installed Node.js)

Postman + Newman + Jenkins ( installed Node.js)

 

 

1 Open the postman

 

 

 

2 In the postman Create a Collection , and configure the new Request , I use the interface card collection before refueling make presentations, as follows:

 

 

 

3 requests the first postman one by one by a test run

 

 

 

4 then Runner run after the test by

 

 

 

 

 

5 install node.js

Install the official website address: https://nodejs.org/zh-cn/download/

Recommended to choose windows installation package 64-bit (.msi)

 

 

 

6 Installation Newman

Newman no interface, unlike the postman as can be seen running interface window

Newman is based on node.js , so I want to install Newman , must ensure that locally installed node.js : determine whether to install node.js . Only in cmd to the next node --version to:

Display publication of this number, it can prove node.js environment normal

Installation Newman :

Command: npm i -g Newman

Successful installation, enter newman -v to check the version, the version is displayed it means that the installation was successful:

(I have installed, security is no longer a)

Check the installation results: Newman -v

Newman successful installation, already exists

View Location:

 

 

 

Features:

Newman command command is the main tool newman run

Format: Newman RUN [Options] <Collection>

The Option : Option

Collection : a collection of the exported file .json format

 

 

 

7postman derived Collection , as .json file

(Such as the use of the environment will be exported along with the environment)

Export collection

 

 

 

Export environment or globals

(I did not use environment, so do not export)

 

8 first in the windows command line to run Newman command to generate html reports

cmd + Enter to start the command line

The export of collection.json file

 

Results of the

 

The Iteration : the number of iterations

Requests : sending a request frequency

Scripts-the Test : the number of requests after the script

Scripts-Prerequest : the number of requests before the script

Assertions : Assertion number

Use of the environment

RUN Newman (collection.json) -e - (enviroment.json) (environment variables)

RUN Newman (collection.json) -e - (globals.json) (global variables)

Generate html test report format

First install a html format report plug-ins

命令:npm install -g newman-reporter-html

 

Executed again newman command and generate reports

Successful execution (command line is not output)

Report ( collection.json at) the same level of new directory newman folder inside

 

 

 

In html generate a report earlier in the command line generated in

 

 

 

9 download extract Tomcat , installation jenkins and configuration jenkins.war package. Login jenkins

The jenkins.war bag on tomcat 's webapp directory (that we will)

1.  entering the tomcat 's bin directory, click the Startup ( Windows batch commands) start jenkins

2.  In the webapp enter the directory cmd , enter the command: the Java -jar jenkins.war start jenkins

 

 

 

10 in Jenkins running Newman command

Access localhost: 8080

Log in to install the plug skip

New Task:

 

 

 

Select the build mode: Chinese name ( Windows batch commands)

 

 

 

 

Enter the command and save

Command: command and gives the file path (Newman position: where newman)

C:

C:\Users\Lenovo\AppData\Roaming\npm\newman run C:\Users\Lenovo\Desktop\floder\gs.json

After saving the task in the current display, click on build

View output: build success

 

 

 

 

 

 

 

 

 

 

11 Timing Construction

The Triggers Build (Chinese: Building Triggers)

 

Timing build grammar

* * * * *

(Five stars, separated by a space)

The first one * represents minute, ranging 0-59

Second teeth * denotes hours, ranging from 0 to 23

Third satellite * day of the month, ranging from 1 to 31

Lesson * denotes few months, ranging from 1 to 12

The fifth teeth * represents the day of the week, ranging from 0 to 7 , where 0 and 7 representatives are Sunday

* Number equal to H , represents any of a reasonable number

 

Use (construct task English symbol timing symbol)

Example:

1 per 30 Construction minutes

H/30 * * * *

 

 

 

2 every 2 th Construction hours once

H H/2 * * *

 

3 every morning 8 Dian build a

H 8 * * *

 

4 per day . 8 point 12 is point 22 is point to build one day 3 times

H 8,12,22 * * *

 

5 month 3 numbers Monday 8 Dian 30 Fen built once

30 8 3 * 1

 

Finally, do not forget to complete the task set the timer application ( the Apply ) + save ( the Save )

 

Guess you like

Origin www.cnblogs.com/wangx123sec/p/11564381.html