Found 75 Articles for REST API

What is Pre-Request Script in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:01:44

1K+ Views

The Pre-Request Script is used to run a JavaScript prior to the execution of a request. By incorporating a Pre-Request Script for a Collection, request or a folder, we can execute precondition steps like defining a variable, Parameters, Headers, Response, or logging console output.We can include a Pre-Request Script to set the order of execution of requests within a Collection. A Pre-Request Script can also handle a scenario in which a value yielded from the request one has to be fed to the next request or the value yielded from the request one has to be processed before moving to ... Read More

How to set a Test in Postman with JavaScript Method?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:00:15

234 Views

We can set a Test in Postman with JavaScript method. In Postman, a test executes provided a Request is successful. This is because a test is created to include checkpoint and validate various parameters of the Response.Tests implemented in the JavaScript method are written within the Tests tab.Add the below JavaScript test −tests["Verify Response Time"] = responseTime > 600The tests is a variable of type array which can store data types- integer, string, Boolean and so on. Verify Response Time is the test name. The responseTime captures the time taken to obtain the Response.Select a GET request and enter an ... Read More

How to run Collection Runner in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:58:38

632 Views

We can run Collection Runner in Postman with the help of the below steps −Click on the Runner menu in the Postman application.The Collection Runner window gets launched.Click on the Collection name from the section – Choose a collection or folder.Choose an Environment from the Environment list box and enter the number of Iterations. Also, we can set a delay time in milliseconds.We have to select a file type from the Data field if we are utilizing data from a file. Then click on the Run Collection1 button.The Collection Runner result page gets opened. The tests get triggered as per ... Read More

Postman Cheat Sheet

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:25:58

991 Views

This Postman Cheat Sheet is based on the official documentation page of Postman (which is available in the below link) and from the overall knowledge on Postman −https://learning.postman.com/docs/getting-started/introduction/a. VariablesAll the variables can be set up manually from the GUI of Postman and they have a defined scope. The values of the variables can also be set with the help of scripts written under the Pre-request Script or Tests tab.The variables can be added in the request URL, Headers and Body in the format as {{}}.Usage in request URL −https://{{domain}}about/{{id}} Usage in request Headers(key-value): X-{{key}}:valueUsage in request Body −{"registration_id": "{{Id}}", "firstname": ... Read More

Postman with Newman & Jenkins

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:44:09

357 Views

We can integrate Postman with Newman and Jenkins. Newman is used to verify and execute a Collection. To integrate Newman and Jenkins, we have to follow the below steps −Step1 − We have to complete the installation and configuration of Jenkins. The steps to perform this task is discussed in details in the below link −https://www.tutorialspoint.com/jenkins/jenkins_installation.htmStep2 − We have to install npm and Nodejs. For installation of Nodejs can be done from the below link −https://nodejs.org/en/download/current/Step3 − The npm is allocated with Nodejs so once we download the Nodejs, the npm gets downloaded automatically.Step4 − We have to install Newman ... Read More

What is Execution order of Collection Runner in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:35:14

782 Views

While executing a Collection, the requests are run in the same sequence as they appear in Postman. Let us have a Collection with at least two requests. To trigger them for execution, first click on the arrow appearing to the right of the Collection name in the sidebar. Then click on Run.Collection Runner pop-up comes up. The RUN ORDER section shows the order in which the requests shall get executed from top to the bottom. (GET->POST->DEL->PUT). Click on the Run Collection1 button.Execution Results show the GET request executed first, followed by POST, then DEL finally PUT, as specified in the ... Read More

How to set Tests using Functional Method in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:01:15

334 Views

We can set Tests using the Functional method in Postman. A test in Postman gets executed only if a Request is successful. In case a Response does not get generated, the test does not to validate it.Tests implemented in the Functional method are written within the Tests tab.Add the following verification using the Functional method within the Tests tab −pm.test["Status Code is 401"], function(){ pm.response.to.have.status(401) })Here, pm.test is the function. Status Code is 401 is the test name which shall be displayed in the Test Result tab after execution. The pm.response is used for getting the Response ... Read More

How to set Multiple Tests for a Request in Postman with JavaScript Method?

Debomita Bhattacharjee
Updated on 25-Jun-2021 12:59:27

683 Views

We can set multiple Tests for a Request in Postman with JavaScript method. A Test in Postman gets executed only if a Request is successful. In case a Response does not get generated, a test does not to validate it.Tests implemented in the JavaScript method are written within the Tests tab.Add the following JavaScript verifications within the Tests tab −tests["Status Code should be 200"] = responseCode.code === 200 tests["Response time lesser than 10ms"] = responseTime

What are different Parameters available in Newman using Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 12:55:27

611 Views

There are different parameters available in Newman. Newman's command to list down all options is − newman run –h. Options in Newman is grouped into categories listed below −UtilityBasic setupRequest optionsOther Misc. OptionsUtility-h, --help – displays usage information.-v, --version - displays version number.Basic Setup--folder [name of folder] – points to a folder in Collection for execution.-e, --environment [name of file| URL] - points to an Environment in the form of JSON file.-d, --iteration-data [file] – mentions a data file to utilize either csv or json.-n, --iteration-count [number] – specifies the count of iterations to.Request Options--delay-request [number] – configures delay in ... Read More

How to Use WebDriver Javascript Executor to Navigate to a URL using Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:25:00

989 Views

We can use the Selenium webdriver JavaScript Executor to navigate to a URL. Selenium can run JavaScript commands by using the executeScript method.The parameters to be passed to the executeScript method to navigate to a URL is - window.location = \'"+s+"\'. Here, s is the variable which stores the link of the page to navigate.SyntaxJavascriptExecutor js = (JavascriptExecutor) driver; String s = "https://www.tutorialspoint.com/about/about_careers.htm"; String scrpt = "window.location = \'"+s+"\'"; js.executeScript(scrpt);Code Implementationimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.JavascriptExecutor; public class LnkJSNavigate{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java      \chromedriver.exe"); ... Read More

Advertisements