Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

Page 10 of 59

How to pass the request body from an external file in a separate package in Rest Assured?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 17-Nov-2021 1K+ Views

We can pass the request body from an external file in a separate package in Rest Assured and pass that file directly to a request as a payload. This technique can be used for static payloads or payloads having slight changes.The RequestSpecification interface has a method called the body. It is an overloaded method that can send payloads in various formats.Let us create a JAVA file, say PayLoad.java, and add a request body in the below format. This is created within the project in a separate package.Code Implementation in PayLoad.javapackage files; public class PayLoad {    public static String pay_load() ...

Read More

How to verify a JSON response body using Assertions in Rest Assured?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 17-Nov-2021 11K+ Views

We can verify the JSON response body using Assertions in Rest Assured. This is done with the help of the Hamcrest Assertion. It uses the Matcher class for Assertion.To work with Hamcrest we have to add the Hamcrest Core dependency in the pom.xml in our Maven project. The link to this dependency is available in the below link −https://mvnrepository.com/artifact/org.hamcrest/hamcrest-coreWe shall send a GET request via Postman on a mock API, observe the Response.Using Rest Assured, we shall verify the value of the Location in the Response body.Code Implementationimport org.hamcrest.Matchers; import org.testng.annotations.Test; import static io.restassured.RestAssured.given; import io.restassured.RestAssured; public class NewTest { ...

Read More

Uploading file to S3 using Rest Assured multipart.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 17-Nov-2021 1K+ Views

We can upload files to S3 using Rest Assured multipart with the help of the below techniques −Rest Assured has the default URL encoding feature. The issue with S3 URLs is that they contain special characters such as %2A, %3D. As the URL encoding feature is configured to true value by default in Rest Assured, we are required to set it to false so that the special characters are not transformed to ASCII equivalent value during runtime.Syntax −given().urlEncodingEnabled(false)Rest Assured appends a default charset to the content. This causes a problem if the content type is not given. In some scenarios, ...

Read More

How to parameterize tests with multiple data sets using Rest Assured?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 17-Nov-2021 2K+ Views

We can parameterize tests with multiple data sets using Rest Assured. Using data providers we can execute a single test case in multiple runs. To know more about TestNG data providers visit the below link −https://www.tutorialspoint.com/testng/testng_parameterized_test.htmThis technique can be used for dynamic payloads. For this, we shall create a Java class containing the payload.Then in the second Java class (having the implementation of the POST request), we shall pass the dynamic fields of the payload as parameters to the request body.Please find the project structure for the implementation below.Code Implementation in NewTest.javaimport org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static io.restassured.RestAssured.*; import io.restassured.RestAssured; ...

Read More

How to create a project with Cucumber and Rest Assured dependencies?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 17-Nov-2021 950 Views

We can create a project with Cucumber and Rest Assured dependencies. This can be done by following the below steps −Step 1 − Create a Maven project. The details on how to create a Maven project is discussed in detail in the below link −https://www.tutorialspoint.com/maven/index.htmStep 2 − Add the following dependencies in the pom.xml file in a project for Cucumber.Cucumber JVM - Java dependencyCucumber JVM - JUnit dependencyhttps://mvnrepository.com/artifact/io.cucumber/cucumber-junitStep 3 − Add the following dependencies in the pom.xml file in the project for Rest Assured.Rest Assured dependencyhttps://mvnrepository.com/artifact/io.rest-assured/rest-assuredJackson Databind dependencyhttps://mvnrepository.com/artifact/com.fasterxml.jackson.core/jacksondatabind

Read More

Disadvantages of Monitors in Postman

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Aug-2021 635 Views

Though Monitors in Postman have many features, it has some disadvantages as well. However, it is up to the end user if he should consider these features as drawbacks for Monitors.Disadvantages of monitors are listed below −Postman Monitors are non-functional provided the Postman server resides in the same server where we are. Thus it makes it difficult to determine the performance of a Collection in a different network.To solve this problem, we need to buy the Postman pro-version. On doing so, the Postman shall then give us another IP address with which we would be able to execute Monitors.Postman Monitors ...

Read More

Analyzing Monitor Results in Postman

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Aug-2021 214 Views

Once a scheduled Collection Monitor gets triggered, we have to analyze the results. Click on the Monitor name available under the Monitors tab.A new window opens in the browser that shall redirect to the Postman account that we are signed in.If we analyze the performance graph of the API in the above image, we see the red bars which depict tests have failed for the request. A green bar points to the fact that tests have passed. On hovering on a particular bar, we shall get date, time, Response time and the percentage of test result for a particular run.Also, ...

Read More

What are Postman Monitors?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Aug-2021 1K+ Views

Postman Monitors are used to ensure that the performance and the Response obtained from an API are being maintained properly. Monitors are scheduled on a regular interval of minutes, hours or weeks for the entire day.The steps to create a Postman Monitor are listed below −Step 1 − Click on the arrow symbol to the right of the Collection name. Then click on the Monitors tab.Step 2 − Click on the Create a Monitor button.Please Note −  we have to Sign in to a Postman account in order to create a Monitor.Step 3 − Provide an input to the Monitor ...

Read More

How to Generate Newman Reports on Jenkins using Postman?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Aug-2021 450 Views

We can generate Newman reports on Jenkins. The reports obtained from Jenkins are a pictorial and organized representation of test execution results. These reports can also be shared with all the stakeholders of the project.Jenkins reports can be generated in several formats and can be controlled by adding different flags in the build commands. Also, it is necessary to specify the path where the reports shall be saved in build commands.The steps to generate Newman reports on Jenkins are listed below −As a prerequisite, Jenkins should be configured in the system. The details available in the link − https://www.tutorialspoint.com/jenkins/index.htm. Also, ...

Read More

How to Remove Unicode from Jenkins Console Output logs using Postman?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 03-Aug-2021 621 Views

We can remove Unicode from Jenkins Console Output logs. To perform this, we should create a Collection with at least a single request. Along with it, we have to install Newman.Step 1 − Click on the arrow appearing to the right of the name of the Collection. After that, click on Share.Step 2 − SHARE COLLECTION pop-up shall open. Navigate to the Get public link tab and copy the link which is pointed out in the below image.Please note − The link obtained is specific to a particular user.Step 3 − Launch Jenkins and go to the Jenkins Job which ...

Read More
Showing 91–100 of 590 articles
« Prev 1 8 9 10 11 12 59 Next »
Advertisements