Integrating Postman with Worksoft Certify – API Testing

Integrating Postman with Worksoft Certify - API Testing

Postman is a scalable API testing tool that helps to build, test and modify API’s. It is used by 5 million developers each month to make their API development easy and simple. To know more about Postman, please visit Postman.com.

As you are already aware of Worksoft Certify integration with SoapUI for API testing, Worksoft has also introduced Postman Interface in the Worksoft Certify version 10.1.0 and above. This interface in Certify enables users to integrate existing API tests from Postman. This feature allows users to point to a Postman collection/environment and run its tests using Postman’s Newman CLI. Please visit the below link to know more about Newman command line interface. https://learning.postman.com/docs/postman/collection-runs/command-line-integration-with-newman/

Once integrated, Certify process can not only send and receive variable values from Postman tests but also the result status once the execution is complete. The biggest advantage of this integration is to leverage existing Postman tests with Certify’s E2E business process tests. This can eventually reduce the effort of executing Postman and Certify as separate tests, thanks to the integration developers.

Now let us begin with the integration process by creating a simple API test in Postman.

Postman Steps

1. Installing Postman

To install Postman, please visit the below link and download the suitable version of your choice based on your OS architecture

download postman for windows

Once downloaded, install and launch the application. Your Postman UI should look something like below.

Note: You will need to create a free user account to use Postman.

postman2. Creating a Postman Collection and a Request

I am going to use the below sample rest API for this integration

https://reqres.in/api/users/7

This will display the Employee details based on the ID specified in the API request URL.

In this case the ID is 7. The output looks like below in browser.data

In Postman, click on the “New Collection” button to create a collection for grouping requests that are easier to group and manage requests.

new collection

Input Collection Name and click on “Create” button

employees demo

Let us now add a Request under this collection

Add request

Provide Request name and click on “SavetoEmployeeDemo” button

Validate employee

Under the request, paste the API URL and click on “Send” to get the response containing the employee details.

collections

You should see the response body and with the corresponding employee details.

3. Parameterizing the API Request

Let us now parameterize the API so the value can be passed from Worksoft Certify. We will need two variables, ID and Name.

ID is for the input data for the API Request

Name is to store the “first_name” value from the response returned

To create a collection variable in Postman, edit the collection and in the “Variables” tab,Input“ID” variable and its value.

edit

Edit collection

 

Now let us create an environment variable called “Name” in Postman to store the “first_name” value from the response returned.

Click on the “Environment Quick Look” button to add an environment variable

 

Environment Quick look

 

Click on “Add

 

No Environment Add

Input Environment Name of your choice and a Variable Name. In our case the variable name is “Name”. The value is left blank as it is an output variable. Later in this article, we will see how to store the output into this variable.

 

Manage Environments

 

You are all set! Close the “Manage Environment” screen and choose the environment you just created from the drop down as shown below.

 

Manage Environments 2

Employee demo

Now let us parameterize the API to use the ID variable created above instead of the hard-coded value “7”

Validate employee

ID Variable is enclosed with two curly braces

 

You should now see the response output based on the value specified in the “Variables” tab

Variables4. Creating a Test Case to validate the response

To create a test case in Postman, click on the “Tests” tab and write your tests in JavaScript

For this demo we are going to input the below code to verify the response status and store the “first_name” response value in the “Name” variable created in the step 3.

Paste the below JavaScript code in your Postman “Tests” tab

 

pm.test(“Status code is 200”function () {

    pm.response.to.have.status(200);

});

console.log(responseBody)

jsonString = JSON.parse(responseBody)

pm.environment.set(“Name”, jsonString.data.first_name);

console.log(pm.environment.get(“Name”))

;

validate employees

Click on “Send” button to execute the request with the test. You should now see the “Test results” tab with the test result PASS/FAIL

send

test results

You can also see the “Name” environment variable is now populated with the value of “first_name” from the response returned.

first name

You can check the Postman Console window (Alt+Ctrl+C) for the console output steps specified in the test steps above.

postman console

Save the Postman Collection and we are done here!

save

Worksoft Certify Steps

  1. Pre-Requisites

You will see the below error in Certify during execution if this installation is not successful. “wsTest.Support.DispatchStepToInterface – wsPostman.Main cannot be loaded

Trending articles

 

  • Create an “Application” in Certify with “Postman” interface checked and link this application to your project

Postman interface

  • Create a “Window” under your “Postman” application to use them for your process steps

New window

Postman Edit window2. Creating Certify Process to Execute Postman Tests

The below Certify steps will point to a Postman collection, pass input data, execute the Postman test and get the output.

steps

Copy Postman Collection path/URL from Postman GUI using the steps below

 

collections

Export collection

Save the collection to a location on your hard drive.

Paste the saved collection path in the “Configure” step below

 

Configure

The below step will pass the input data to Postman. “Data Variable Name” here refers to the variable in Postman

Data Variable name

Run” step will execute the Postman collection. You can use default parameters in Certify.

Parameters for run

Finally, get the output from Postman and store it in a Certify variable for validation. “Variable Name” here refers to the variable in Postman.

Get Variable

3. Executing Postman Tests from Certify

 

Executing Postman Tests from Certify

This concludes the integration with Postman.

 

Reference and Credit

https://www.worksoft.com/

https://docs.worksoft.com/

https://portal.worksoft.com/

https://postman.com/

Leave a Reply

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code
 

Archives

Leave us your info