Debomita Bhattacharjee has Published 872 Articles

How to map a step definition to a feature file in Cucumber?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 10:33:39

We can map a step definition file to a feature file in Cucumber. This can be done using the below steps −Step1− Create a feature file with .feature extension(say Login.feature) with the following −Feature − Login ModuleScenario − Welcome Page Login verificationGiven User is on Welcome PageThen Welcome page should ... Read More

How to create a step definition file for Cucumber in Java?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 10:30:42

We can create a step definition file for Cucumber. This can be done using the below steps −Step1− Click on the File menu in Eclipse. Then select the option New. Next click on OtherStep2− Click on Maven Project from the Maven folder. Then click on Next.Step3− Proceed with the further ... Read More

How to use Assertion in response in Rest Assured?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 10:26:21

We can use Assertion in response in Rest Assured. To obtain the Response we need to use the methods - Response.body or Response.getBody. Both these methods are a part of the Response interface.Once a Response is obtained it is converted to string with the help of the asString method. This ... Read More

How to transform the response to the Java list in Rest Assured?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 10:23:18

We can transform the response to Java list in Rest Assured. This can be achieved when we have a JSON array Response. To convert the JSON array to List, we need to use the method as.(List.class).Once the JSON array Response is converted to a List, we need to convert it ... Read More

Explain how to get the size of a JSON array response in Rest Assured.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 10:20:17

We can get the size of a JSON array response in Rest Assured. First, we shall obtain a Response body which is in JSON format from a request. Then convert it to string. Finally, obtain its length with the size method. Code Implementationimport static io.restassured.RestAssured.given; import org.testng.annotations.Test; import io.restassured.RestAssured; import ... Read More

How to create a Feature file for Cucumber in Java?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 10:17:28

We can create a Feature file for Cucumber. This can be done using the below steps−Step1− Click on the File menu in Eclipse. Then select the option New. Next click on OtherStep2− Click on Maven Project from the Maven folder. Then click on Next.Step3− Proceed with the further steps.Step4− Select ... Read More

How to add Cucumber Maven dependencies to the project?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 10:10:33

We can add Cucumber Maven dependencies to a project. This can be done by following the below steps −Step1− 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.htmStep2− Add the following dependencies in the pom.xml file in ... Read More

How to get a value from a nested list in Rest Assured?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 10:02:42

We can get a value from a nested list in Rest Assured. This is done with the help of the extract method. To grab the item, we have to use the path method(after the extract method) and pass the item in the response we want to obtain.We shall first send ... Read More

Explain how to extract value using JSONPath.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 09:59:08

We can use JsonPath in Rest Assured to extract value. This is done with the help of the jsonPath method (which is a part of the JsonPath class). After that, we need to use the get method and pass the key that we want to obtain from the JSON Response.We ... Read More

How to use the then method in Rest Assured?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 22-Nov-2021 09:54:20

We can use the then method in Rest Assured. It is mainly used to validate a Response obtained from a request. Thus, most assertions are included within a then method.SyntaxRestAssured.baseURI = "http://dummy.restapiexample.com"; //GET operation with then methods given() .when().get("/api/v1/employees").then() //verify status code as 404 .assertThat().statusCode(404);ExampleCode Implementationimport org.testng.annotations.Test; import ... Read More

Advertisements