Questions tagged [rest-assured]

REST Assured is a Java library that provides a domain-specific language (DSL) for writing powerful, maintainable tests for RESTful APIs.

REST Assured enables testing of REST services in Java.

It uses a fluid syntax inspired by similar libraries for and .

2207 questions
0
votes
1 answer

Exception "No such field: age for class: java.util.HashMap$Node" when search via "findAll" in response body

Good day. I try to validate a value of the "name" field in JSON response via "findAll" with the known value of the "age" field. Unfortunately, I get an exception "java.lang.IllegalArgumentException: No such field: age for class:…
0
votes
2 answers

Unable to read payload from File

i am trying to insert payload from jsonfile but getting an bad request and unable to read date from the file , not sure what i am doing wrong File jsonBody =new File(".\\JSONFileinput\\file.json"); Response…
Gurumurthy S
  • 11
  • 1
  • 4
0
votes
1 answer

How to write generic function to set token and cookies received from one GET API to test other APIs using Rest Assured

Below code is working for APIs written in one test but I want to use authentication in other test classes. Please help me with that I am using JAVA @Test(priority = 01, groups = { "API", "API Testing" }, description = "Validate ") public void…
0
votes
2 answers

What is the difference between given() and with() in Rest Assured?

RequestSpecification request1 = RestAssured.given(); // Setting Base URI request1.baseUri("https://restful-booker.herokuapp.com"); // Setting Base Path request1.basePath("/booking"); // Creating request…
0
votes
3 answers

Validate JSON response key label is present and value is not null in java

We have API which gives response array with label and values Below is structure "Name":"XYZ" "Resultid": [ { "subject": "English", "Marks": "79" }, { "subject": "English", …
0
votes
1 answer

Can't attach RestAssured's RQ/RS of Spring Cloud Contract's tests to Allure report

I've successfully added Allure2 to my project with Spring Cloud Contract tests (it uses JUnit5), but tab "Overview" is blank in all successed test of report. I created a listener class, that gets RQ and RS from RestAssured: public class…
Daemon2017
  • 115
  • 1
  • 2
  • 9
0
votes
0 answers

unable to marshal type "[B" as an element because it is missing an @XmlRootElement annotation

I was trying to send xml data after converting to UTF-16 encoding format and sending to put endpoint but seeing below exception. Caused by: com.sun.istack.SAXException2: unable to marshal type "[B" as an element because it is missing an…
Karunakar Reddy L
  • 342
  • 1
  • 4
  • 21
0
votes
1 answer

Need to whitelist ip ranges if i'm calling APIs during running test scripts on aws device farm (I'm using rest assured)

I'm using rest assured in calling APIs and as I run scripts on testing environment I need to know ip range to white list it
0
votes
1 answer

RestAssured : PATCH : 500 using rest assured but success in postman

I automated one of the patch request using Rest-assured, it was working before and suddenly it stopped working and throwing 500 error but the same requests works just fine in Post man. Please help given() …
sensit
  • 3
  • 1
0
votes
0 answers

Programmatically turn on or off global RestAssured logging to Slf4j

I'm trying to configure a RestAssured setup wrapped in Spring test and Junit. Regarding this I'm struggling with making the logging optional based on a config value. I found this link https://github.com/rest-assured/rest-assured/wiki/Usage#logging…
0
votes
1 answer

Restassured: How Can we compare each element in Json array to one particular Same value in Java using Hemcrest Matchers, not using Foreach loop

Restassured: How Can we compare each element in Json array to one particular Same value in Java using Hemcrest Matchers, not using Foreach loop. { "id": 52352, "name": "Great Apartments", "floorplans": [ { "id": 5342622, …
0
votes
1 answer

Validate Response which contain only message in Response Body

We are testing API Automation with Rest Assured in Java. In Postman, we run API after success gives message as "Record Saved Successfully" Trying to automate the same. How to validate only message recieve as response in…
Vipin Singh
  • 109
  • 1
  • 14
0
votes
2 answers

Need to get value after Domain name in url using java

We are getting url from JSON Response and which we open in in Chrome.The page loads , there is submit button which we click then it redirect to url as :- https://www.google.com/AB1234 We need the need to retrieve only "AB1234" value from url. tried…
Vipin Singh
  • 109
  • 1
  • 14
0
votes
0 answers

How to return all errors of a schema using RestAssured

I am trying to validate a schema using RestAssured. I have a response { "a" : 1, "b" : 1, "c" : 1 } and I have a schema like shown below { "type" : "object", "properties" : { "a" : { "type" : "string" }, "b" : { "type" :…
0
votes
1 answer

what is "def" in Java class

Currently, I am using RestAssured for API automation in my project. As we know, it is a Java Project. When I look at the code of class named "TestSpecificationImpl" in Rest-Assured API. I can see that, it is using methods like: def Response put(URL…
Pramod Kajla
  • 113
  • 1
  • 10