How to fixed Postman API Test Collection using Nodejs (newman)and Unicode Problem Windows 10
Tags: testing, devops
Published: 2019-10-22 10:47:38

Our main goal of continuous integration is to identify the problems that may occur during the development process earlier and more easily.
Passionate about automation and optimizing the best processes. Continuous Integration (CI) is a software development practice that is based on a frequent integration of the code into a shared repository.
Most commonly used Jenkins because Jenkins is an open-source automation server. Its main objectives are to detect changes in subversion or git and to perform tasks repeatedly (i.e., build, test, deploy, package, integrate). In general, Jenkins allows one to create a complete CI cycle.
Continuous Integration Systems has many benefits but sometimes face setup related issues. To fixed two-issue windows to console reports and Unicode related issues.

How to run newman command in Jenkins-
Pre-requirement — Install Nodejs — https://nodejs.org/en/
Choose new FreeStyle Project-
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1nr2k4xynfxgd7uz0zev.JPG)
Then choose Build > Execute Windows batch command
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/v9qqup3ct347lvqt5nb9.JPG)
The console output result should look like this: (Windows)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pb5v360bjp2hwxtrc5xq.JPG)
Ok. Now everything ready but newman issue. Now we need to fix that newman issue.
First Need to install — Nodejs Plugin > Manage Plugins > Available > Search — Nodejs > Check box > Install and Restart
Now let’s go to Jenkins > Manage Jenkins > Global Tools Configuration
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/s53ktskex8zyg1isshra.JPG)
Apply then Save. :)
Now Edit Project —
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/iutj8d5ivkvvywmbkbcc.JPG)
Check box click — Provide Node & npm bin / folder to PATH. Apply & Save
Again Build Now —
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/3iwu00okckd7dkloikb0.JPG)
Congratulations! but one more issue again. Unicode related issue :(.
UTF-8 encoding issue resolution method in Jenkins — (One)
Go to Install Project directory — C:\Program Files (x86)\Jenkins
Open > jenkins.xml
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/2mimaqwldjs4hqprj0pt.JPG)
-Dfile.encoding=UTF8
Save then Restart — Jenkins Service
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pj9x4p0o6it496h1clco.JPG)
Again Build Now —
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/e2ctf5sizl1y9wdd4l1v.JPG)
Congratulations and Successfully Fixed Unicode Issue.
Another different way to fix Unicode issue -
To resolve the encoding issue we have to add the environment variable in system as shown below first.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/n9qwmxebwrqcbw98kcql.JPG)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/u0ctgtjg8jm5xigbmy24.JPG)
Save then Restart — Jenkins Service
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/50sr1qh2lab008fgdg6c.jpg)
These environment variables were added in Jenkins as well which has resolved the encoding issue.
Jenkins -> Manage Jenkins -> Configure System ->Global properties.