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

RestAssured vs Mockmvc for unit and integration testing

I am asked to choose one and the best from these two for unit and integration tests- 1. RestAssured 2. Mockmvc The application is in Spring and Spring Boot. I have read many blogs and no clear distinction is given or I couldn't find one. For rest…
a p
  • 1,121
  • 6
  • 26
  • 51
4
votes
1 answer

Using SpringBootTest annotation

I've built an API using Spring Boot and have a few unit tests associated with it so far. As expected these are ran locally and when Jenkins builds the project via gradle build on the build server. I'm looking to add some integration tests to the…
Matt Damon
  • 323
  • 1
  • 6
  • 18
4
votes
4 answers

How to assert based on body item with Rest Assured with JSON response?

How can I assert my properties inside the "description" array using the rest assured .body() method. Example: .body ("[0] .userType", equalTo (1)); // error Here is my current JSON data which I want to assert with: { "validSession":…
JJB
  • 115
  • 1
  • 1
  • 7
4
votes
2 answers

How to retrieve field value from json object when object name has DOT in it

I want to extract "msg" value from below json using fasterxml.jackson - Can anyone suggest me how my model class should look like? { "statusCode": 422, "error": "Unprocessable Entity", "message": "Bad data received", "err_data": { …
Paresh
  • 1,140
  • 2
  • 12
  • 29
4
votes
4 answers

Rest Assured vs Cucumber

I know what Rest Assured is and for what purpose it is used and the same for the cucumber. But the thing is what we can achieve with Rest Assured, we can also do with Cucumber for testing. Rest Assured simply calls the web service and validates the…
Dead Programmer
  • 123
  • 1
  • 5
  • 14
4
votes
3 answers

Deploying microservice to be tested within the test

Maybe this is not possible to do generically in a test framework but I would like to be able to deploy the microservice I am testing within the test itself. I have looked at Citrus, RestAssured, and Karate and listened to countless talks and read…
4
votes
4 answers

Rest Assured: extract value from Response List

I have a List returned as response. I need to get one item from list using product.name and tariffPlan.name. [ { "id": 123, "product": { "id": 1, "code": "credit", "name": "Credit" }, "tariffPlan": { …
Антон
  • 91
  • 1
  • 1
  • 5
4
votes
3 answers

How to ensure that a cookie is NOT present

What would be a good way in REST Assured to ensure that a cookie is absent? I checked that there are many .cookie and .cookies methods, but none support checking the absence of a cookie.
Sanjay
  • 8,755
  • 7
  • 46
  • 62
4
votes
1 answer

How to send JsonObject in body for post request using rest assured?

I have a JsonObject created using Google Gson. JsonObject jsonObj = gson.fromJson(response1_json, JsonElement.class).getAsJsonObject(); Also i made some modification to existing jsonobj as below : JsonObject newObject = new JsonObject(); …
ButterSkotch
  • 75
  • 1
  • 1
  • 6
4
votes
1 answer

Restassured "OR" condition

I have REST for finding users by name, which for some search term returns users that has that term in first name or last name. GET /search/joe returns json array: [ {"id": 1, "firstName": "Joe", "lastName": "Doe"}, {"id": 2, "firstName":…
petronic
  • 43
  • 5
4
votes
1 answer

How to configure Rest Assured to Wait until complete response data is returned

Would you please advise how to configure RestAssured to wait until complete response data is returned. I am trying to validate a data feed using http get as shown below. given() .relaxedHTTPSValidation() .header("Content-Type",…
brzspirit
  • 99
  • 3
  • 10
4
votes
0 answers

How do I prevent RestAssured from overwriting mocks with real implementations?

I'm trying to test a Jersey REST service endpoint with RestAssured while mocking its dependency. I use Spring to autowire the endpoint, and I set a mock dependency before executing the test. However, when RestAssured calls the service, it gets…
Vytautas
  • 452
  • 3
  • 11
4
votes
2 answers

Is there an advantage in using SOAP UI over REST-assured to automate REST Services for CI

I have to automate REST API testing in my project and integrate it in to existing CI in jenkins. I am about to start coding using REST-assured.However I happened to see SOAP UI REST tutorial and understand that there is a maven plugin in SOAP UI to…
QVSJ
  • 1,165
  • 2
  • 12
  • 22
4
votes
1 answer

Rest Assured Output : print URL

I would like to see which URL Rest assured has constructed for test. My code is pretty vanilla. ValidatableResponse response = given(). auth().preemptive().basic("User", "Passwd"). …
MonoThreaded
  • 11,429
  • 12
  • 71
  • 102
4
votes
1 answer

REST-assured with Spock and Groovy as integration test

Using REST-assured framework in spock framework. This is answer to closed this closed topic
librucha
  • 635
  • 8
  • 13