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
8
votes
1 answer

REST-Assured - JsonPath for fetching a list of values

I'm using REST-Assured for testing some RESTful webservices. Here's my JSON: { "status":true, "responseData":{ "orderLevelReasons":[ { "reasons":[ { …
Akshay Maldhure
  • 787
  • 2
  • 19
  • 38
8
votes
2 answers

Rest Assured - Cannot serialize because cannot determine how to serialize content-type

I am using Rest Assured for testing API WHEN I post a request for authentication, the error occurs to say that: "java.lang.IllegalArgumentException: Cannot serialize because cannot determine how to serialize content-type…
Tri Nguyen
  • 93
  • 1
  • 3
  • 10
8
votes
3 answers

How to send a multipart request with RestAssured?

I have @Controller with method with signature like this: @PostMapping @ResponseBody public ResponseEntity uploadFileAndReturnJson(@RequestParam("file") MultipartFile file) {} I want to construct multipart request without physically creating…
8
votes
3 answers

How to use REST Assured to upload a file?

I wrote a service which can upload a file to the server, and now I'm writing it's integration test with REST Assured. The functional code is as following: /* Upload a new document */ @RequestMapping(method = RequestMethod.POST) public…
Cong Wang
  • 769
  • 1
  • 9
  • 30
8
votes
1 answer

how to handle Special character in query param value in Rest assured

I'm struggling with handling special character in query parameter value while working with Rest Assured. In url (as given below), I have to pass the value which is separated with pipe symbol '|'. I encoded symbol with value %7C however service call…
Parveen Y
  • 101
  • 1
  • 1
  • 5
8
votes
2 answers

JSON POST using RestAssured

I am trying to create a test to validate the response of a JSON Post is as expected. I am trying to test the POST of a JSON message body to a URL which is turn then sends a text message and if successful it sends a response that it was successful…
user3520080
  • 423
  • 2
  • 11
  • 26
8
votes
1 answer

Spring-boot : how to execute multiple test classes by just starting the service once using rest-assured

I am writing my spring-boot tests using rest-assured and these annotations on the test class - java class 1: @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes =…
worrynerd
  • 705
  • 1
  • 12
  • 31
8
votes
5 answers

Build Failure in Jenkins, Found duplicate resources

I recently added this dependency to pom.xml com.jayway.restassured rest-assured 2.4.0 My builds are failing in jenkins with the following error…
user3443193
  • 113
  • 1
  • 1
  • 4
8
votes
4 answers

Rest-assured. How to check if not empty array is returned?

I have the following code which should test my RESTful API: given().baseUri("http://...").get("/categories/all") .then() .body( "results", not(empty()) ); The API returns the following response: { "error": { "type":…
JustAC0der
  • 2,871
  • 3
  • 32
  • 35
8
votes
1 answer

RestAssuredMockMvc Connection to http://localhost:8080 refused

I developed a Spring MVC webapp with rest methods. I would love to use RestAssured to create JUnit test classes. From the documentation it looks really simple to do but I'm having some problem instead. Basically I want to use it to avoid a runtime…
user3227323
  • 159
  • 2
  • 9
8
votes
2 answers

How do i send JsonObject with nested values as Post request in REST assured

I am using rest assured -https://code.google.com/p/rest-assured/wiki/Usage My JsonObject looks like this { "id": "12", "employeeInfo": null, "employerInfo": null, "checkDate": 1395093997218, "netAmount": { "amount": 70, "currency":…
user3431212
  • 83
  • 1
  • 1
  • 3
7
votes
2 answers

How to compare\assert double values in rest assured

I'm trying to compare\assert double from a JSON with java primitive double value. What is the proper way to do it? I used simple and regular way to do it, using Matchers.equalTo method, see below public class A{ private static double…
7
votes
1 answer

Invalid XML path keys still evaluate in Rest Assured

My example web service is returning following XML. Wrong ID 2 Following tests are…
Pankaj
  • 5,132
  • 3
  • 28
  • 37
7
votes
5 answers

How to post x-www-urlencode request by rest assured

I have a post request where i need to send x-www-form-urlencoded keyValue pair parameters and content-type should be x-www-form-urlencoded. Before coding ,i've tried in postman successfully,just adding…
Williams
  • 71
  • 1
  • 1
  • 3
7
votes
3 answers

Post multipart file and JSON in Rest Assured

I need to send a video file and JSON object in Rest Assured post call. Structure is like the following: { "sample" : { "name" : "sample-name", "kind" : "upload", "video_file" : multipart file here } } So I did like the…
ARods
  • 441
  • 2
  • 5
  • 13