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

Getting SSL error in rest assured

I am working on automating the API testing using Rest assured. I have one API in which if we call that API using http then server would return response code as 302 and location as same URL but with https . I ahve written the below code:…
user35253
  • 143
  • 1
  • 8
5
votes
1 answer

maintaining sessions with RestAssured

How to set session attributes in restassured? In my application code we have something like this String userId= request.getSession().getAttribute("userid") How to set userId as session attribute here(in restassured test case)? How to maintain the…
Naidu
  • 95
  • 1
  • 10
5
votes
1 answer

java restAssured equivalent to cURL certificate options

In my environment, in order to issue successful cURL commands, I must include the following options pointing to files that have been downloaded: --key /path/to/client-private.key --cert /path/to/client-cert.pem --cacert /path/to/caroot.pem I am…
Jeff
  • 51
  • 2
5
votes
4 answers

Rest assured: charset issue - Passing valid contentType using rest assured is not recognized and giving error as Content Type is not valid

Rest assured version: 3.0.5 As a user we have passed contentType as XML in below format with valid content. contentType(ContentType.XML) OR .contentType("application/xml") In application allowed content type was: "application/xml" Supplied…
Diptman
  • 374
  • 3
  • 14
5
votes
2 answers

Any cucumber Before and After hook at a feature level

i have gone through many help, but all are about explaining on scenario level. Is there any Before and After hook at feature level for cucumber JVM.? This page cucumber Hook tells about ruby language, but can i get help for java?
mmar
  • 1,840
  • 6
  • 28
  • 41
5
votes
3 answers

Disable sending null fields via Rest Assured in runtime

Lets assume that I got following model: @Data @NoArgsConstructor @AllArgsConstructor @Builder public class MyModel { private Object field; //required field private Object anotherField; //optional field } Now I would like to verify if my…
Maciej Treder
  • 11,866
  • 5
  • 51
  • 74
5
votes
1 answer

Is there a mechanism for integration testing JAX-RS services without deploying (a la MockMVC)?

I have successfully built no-deployment-needed integration test frameworks for Spring MVC REST services using Mock MVC. I am struggling to do the same with JAX-RS services. REST Assured looks promising, but it seems to require deployment. The test…
5
votes
3 answers

Wildcard in JsonPath

I am parsing a JSON like below: jobs1: [ { request: { body: { jobID: "79ceeeff-53b9-4645-80bd-95dfca6fe1e9", ... jobs2: [ { request: { body: { jobID: "60e7c286-f936-4f96-87bc-6bd55f107514", And looking for a way to use…
Vlad.Bachurin
  • 1,340
  • 1
  • 14
  • 22
5
votes
1 answer

How do I declare a default parser for Rest Assured 3.0.3 (using Java and TestNG)?

Good day folks, I am an admittedly novice Java programmer but I take care to research docs and FAQ's to try to get past issues. This is a problem that I have not been able to overcome, however. I am using RestAssured (version 3.0.3, as pulled by…
m1gp0z
  • 213
  • 2
  • 9
5
votes
1 answer

Rest Assured doesn't use custom ObjectMapper

I'm making Controller tests for my Spring Boot project using Rest Assured. We are using Java 8 ZonedDateTime fields on our serialized objects and Jackson 2 for our serialization. When running the project, serialization works as expected, but when…
AForsberg
  • 1,074
  • 2
  • 13
  • 25
5
votes
2 answers

How to set url encoded form entity and add params to form entity in rest assured?

The below sample code is in http client , But I want to write the same in Rest Assured. I know we can use the http lib in rest assured as well, But I want to have in Rest assured HttpPost pst = new HttpPost(baseUrl,…
5
votes
1 answer

Add request and response detail from REST Assured test to Surefire report

Rest Assured allows to write tests of REST endpoints. One of the useful features it has is the ability to log the request and response in case of a failed test so you can check what was sent to the REST service. Request example An example of a…
sargue
  • 5,695
  • 3
  • 28
  • 43
5
votes
2 answers

How to validate correct values of elements inside arrays with Rest assured

I'm trying to validate some properties of my response as shown in the rest assured tutorial. The problem is that, when testing properties inside an array, I can verify, as in the example, that they appear, but not that they're matched to other…
user384729
  • 403
  • 1
  • 7
  • 16
5
votes
2 answers

Use Multimap instead of Map for sending parameters for Rest Assured Call

I am declaring a variable static Multimap multiList = ArrayListMultimap.create(); and adding values like multiList.put(**key1**,value1) multiList.put(**key1**,value1) multiList.put(**key2**,value3) Now, the request…
5
votes
2 answers

Repeating query parameters in Rest-Assured

I have a Map of parameters. Some of these parameters have lists and rest assured will set the parameter value as a comma separated list: http://url.com/rest?field1=value&fieldlist=1,2,3 I am using jersey and for some reason it…
njfrost
  • 95
  • 1
  • 8