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
6
votes
2 answers

Spring MVC Integration test - how look up request Mapping path?

We have some controller, say something like this: @Controller @RequestMapping("/api") public Controller UserController { @RequestMapping("/users/{userId}") public User getUser(@PathVariable String userId){ //bla } } We have an…
Dan
  • 3,182
  • 1
  • 27
  • 27
6
votes
3 answers

How to fetch JSON object from Json array in REstAssured

Can anyone please help me to solve this scenario: I am new to RestAssured and handling JSON in our automation script. I have an API whose response is JSONArray i.e., [{ "id": 1002, "entity": "testcase", "fieldName": "TextName", …
Kavana
  • 81
  • 1
  • 3
  • 11
6
votes
2 answers

How to post complex XML using rest assured

Using rest-assured we can easily perform GET, POST and other methods. In the example below we are sending a POST to an API that returns a JSON response. @Test public void reserveARide() { given(). header("Authorization",…
Art Pol
  • 81
  • 1
  • 1
  • 4
6
votes
2 answers

REST Assured with JSON schema validation not working

I'm working with Spring Boot and REST Assured to test REST APIs. I was trying the example with JSON schema validation but it throws this error: java.lang.IllegalArgumentException: Schema to use cannot be null According to documentation, the schema…
Zilev av
  • 491
  • 1
  • 7
  • 21
6
votes
4 answers

Multiple Rest calls in Java using RestAssured

When you make a rest request using RestAssured, it appears to wait for a response. I need to make a POST request in RestAssured and then while it waits for a response, I need to make a GET request. I'm using Java and RestAssured. I've also tried…
mmyers
  • 61
  • 1
  • 1
  • 3
6
votes
3 answers

The import org.springframework.data cannot be resolved in gradle

I refreshed my gradle project but it gives me error that " The import org.springframework.data cannot be resolved " The following are some imports which it doesn't understands import org.springframework.data.mongodb.core.MongoTemplate; import…
CandleCoder
  • 1,387
  • 4
  • 21
  • 45
6
votes
3 answers

Using PowerMock to mock static class in a rest-assured test

Is there any way to use PowerMock with rest-assured, because when I'm trying to test a RESTful API with rest-assured. I want to PowerMock a static call. The code of…
John Fadria
  • 1,863
  • 2
  • 25
  • 31
6
votes
4 answers

Null-pointer exception when invoking get in rest-assured: Cannot get property 'assertionClosure' on null object

I am trying to implement tests for an RESTful API using rest-assured, but I am running into a null pointer exception when attempting to invoke a get action. The authorization is a custom scheme, so once I get the authorization signature for the…
Selena
  • 2,208
  • 8
  • 29
  • 49
6
votes
2 answers

Rest-assured requests not working

I am using Rest-Assured to test my Rest API. the webservice seems to be running ok, since running curl -u "admin:admin" http://localhost:8888/users/ i get my Users as json. then, when trying a simple request with Rest-Assured …
danieltorres
  • 370
  • 2
  • 12
5
votes
2 answers

Is Cypress a good choice for API Automation Testing than Rest Assured/Karate?

I have been googling about using Cypress for Automation API testing. I found below links: Example: Cypress Real World App - API Testing Docs: API Testing Blog: Add GUI to your e2e API tests Plugin: cy-api API Testing with Cypress Most of the cases…
Mahesh Magar
  • 69
  • 1
  • 2
5
votes
2 answers

How to validate if the status code returned is Successful i.e any of the 2xx HTTP status codes using Rest Assured?

I would like to assert if the status code returned is any of the 2xx series i.e 200 or 201 or 204. I don't want to do it the old fashioned way e.g. if(response.statusCode() == 200 || response.statusCode() == 201 || response.statusCode() == 204)…
dipindashoff
  • 103
  • 1
  • 6
5
votes
1 answer

RestAssured - Unrecognized field, not marked as ignorable

(Note: I've seen multiple questions answered on the topic of "Jackson complains about unrecognized properties", I've not found one using RestAssured's object mapper specifically) I have a RestAssured test, and it works @Test public void…
Andrejs
  • 10,803
  • 4
  • 43
  • 48
5
votes
0 answers

Ideal way to close connections in RestAssured?

I am using RestAssured for API automation. We have a huge application with so many api calls. So, what could be better way to close the connection after response has been received properly. In that way, I will not be worried about connection…
5
votes
3 answers

Get the "CURL" operation from each Rest Assured test and print in the console when not pass the test

I need Get the "CURL" operation from each Rest Assured test and print in the console when not pass the test. It's possible? For axample, convert: given().relaxedHTTPSValidation(). auth().basic("name", "password"). …
Renzo Parente
  • 315
  • 1
  • 4
  • 10
5
votes
4 answers

rest assured imports are not resolved

I have included rest assured jars in my POM as below. io.rest-assured rest-assured 3.0.0 But still the import statements are showing "The…
Sugan
  • 447
  • 1
  • 4
  • 16