Run collection(suite)/Requests through Jenkins (CI)
What is Jenkins?
Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.
Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.
Install & Configure Jenkins in Windows:
- Jenkins requires Java 11 or 17 since Jenkins 2.357 version
- Search ” jenkins download” or go to https://jenkins.io/download/
- Click on .war file to download due to install in local machine.
- Get the directory/ path of .war file (ex: C:\Users\SeleniumWork)
- Go to terminal/command prompt. Type: cd <directory path of the jenkins.war file>
- Type -> java -jar jenkins.war
- Confirm to see auto generated password (between the 2 sets of asterisks) & copy it.
- Confirm to see message in command prompt as “Jenkins is fully up and running”
- Unlocking Jenkins: Browse to http://localhost:8080 (or whichever port you configured for
Jenkins when installing it) and wait until the Unlock Jenkins page appears. - On the Unlock Jenkins page, paste this password into the Administrator password field
and click Continue - Create Admin user & new password (keep this UserName & Password for future use)
- After unlocking Jenkins, the Customize Jenkins page appears. Here you can install any number of useful plugins as part of your initial setup or you can do it later too.
Click one of the two options shown:
-
Install suggested plugins – to install the recommended set of plugins, which are based on most common use cases.
-
Select plugins to install – to choose which set of plugins to initially install. When you first access the plugin selection page, the suggested plugins are selected by default.
-
- Finally, log-in to your Jenkins account.
Install & Configure Jenkins in Mac OS: Follow this Link..
Note: Make sure to run Jenkins server first before to log-in Jenkins account.
Create Jenkins Job & run the Postman Collection:
- Log-in to jenkins account
Go to New Item> Give (Name) > Free Style Template > Build > Choose Windows batch & enter newman script to execute the exported/shared Collection
Example:
newman run – – disable-unicode <<Share via API link for the collection>>
Or: newman run – – disable-unicode <<path of the exported collection file.json>>