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

How to disable REST-Assured debug printing to console?

By default Rest-Assured is printing too much debug data to the console. Can anyone tell how can I disable it?
Dotan Raz
  • 453
  • 9
  • 24
7
votes
4 answers

Confusion over REST Assured floating-point comparisons

The REST Assured usage documentation has examples like this: get("/lotto").then().body("lotto.lottoId", equalTo(5)); OK, so they are using a Hamcrest matcher to compare to the int value 5. But they have a section saying that the REST Assured JSON…
Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
7
votes
3 answers

javax.net.ssl.SSLException: Certificate for <> doesn't match any of the subject alternative names: []

When I try to Hit the URL using Postman it works fine,by using my personal cert.But when I tried the same using Rest Assured test case it is throwing the above exception. Configuration Class public class Configuration { protected SSLConfig…
Rocky4Ever
  • 828
  • 3
  • 12
  • 35
7
votes
3 answers

Getting "java.lang.IllegalArgumentException: Don't know how to encode XXX as a byte stream."

I want to extract JSON data from a string. Here is my code: String APIBody = "{\"queryString\": \"Pearson AND unscrubbed:false\"}"; RequestSpecBuilder rbuild = new RequestSpecBuilder(); rbuild.setBody(APIBody); rbuild.setContentType("application…
Prasaad C
  • 81
  • 1
  • 1
  • 4
7
votes
2 answers

Rest Assured - retry request if failed

Example Test: @Test public void shouldGetRoutesList() { Response response = given() .headers("RequestId", 10) .headers("Authorization", accessToken) …
Michal
  • 563
  • 3
  • 14
  • 24
7
votes
2 answers

RestAssured - passing list as QueryParam

I have a REST-service that takes in a number of query-params, amongst other things a list of strings. I use RestAssured to test this REST-service, but I am experiencing some problems with passing the list to the service. My…
Tobb
  • 11,850
  • 6
  • 52
  • 77
7
votes
1 answer

Verify integer value in response header using REST-assured

perhaps due to my inexperience with rest-assured and hamcrest matchers I haven't managed to figure out how to do this assertion properly when(). get(url). then(). header("my-header", lessThanOrEqualTo("60")); // should compare…
pseudo
  • 836
  • 1
  • 11
  • 20
7
votes
2 answers

How to use mockito for testing Database connection

I am using Junit to test my jersey api. I want to test DAO without a database. I tried using Mockito but still not able to use mock object to test the DAO which contains Hibernate calls to DB. I want to write Junit for my Helper class which calls…
Jugi
  • 1,244
  • 3
  • 23
  • 51
6
votes
0 answers

Wiremock recording not saving request headers

I am trying to use Wiremocks record and playback feature to record a number of requests. The service I am calling returns different values depending on the headers that are sent in the request so I need the recording to capture the headers. I am…
user889829
  • 388
  • 2
  • 7
  • 20
6
votes
1 answer

How to verify json array using rest assured?

I have a JSON response: ["alice", "jason", "steve", "alex"] then when use rest assured to test: when(). get("/names"). then(). body(containsInAnyOrder("alice","jason","steve","alex")); This is not working as I expected, it gives an…
Jakim
  • 1,713
  • 7
  • 20
  • 44
6
votes
2 answers

How to follow the redirect in rest assured?

I have a spring boot application and a controller will redirect to a page based on the post parameter. And I am creating the test case which want to assert the redirect page But I failed to get the redirected html from the rest assured response …
brian661
  • 538
  • 3
  • 11
  • 31
6
votes
2 answers

How to printout the URL that RestAssured trying to connect with to the web service?

This is very basic and simple question regarding Rest-assured framework. I have been trying to connect to weather webservice api using some param. But i kept getting connection refused. I could not find out what actually the URL that rest-assured…
user1459497
  • 659
  • 2
  • 9
  • 18
6
votes
2 answers

How to allow self-signed SSL certificates in older version of rest-assured

I have to work with old version (1.8.1) of rest-assured framework. And all my post() or get() requests called from rest-assured fails, because server I am using for tests has self-signed SSL certificate. I know that since version 2.2.0 this is…
running.t
  • 5,329
  • 3
  • 32
  • 50
6
votes
3 answers

"Invalid number of path parameters. Expected 0, was 3" error while passing the url parameters in rest api (rest-assured)

Trying to test the rest api with rest-assured. Getting the error Invalid number of path parameters. Expected 0, was 3. public class GetSociailDetails { @Test public void generateToken() { Map userDetails = new…
Nagarjuna Reddy
  • 759
  • 9
  • 19
  • 39
6
votes
1 answer

What is the language that Rest Assured can work with

I have a question about Rest Assured, Is it work with only Java tests? Or I can use It with C# for example? Thanks
Tasnim Zuhod
  • 103
  • 2
  • 2
  • 10