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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

GraphQL API : `variables` in a POST body should be provided as an object, not a recursively JSON-encoded string

I am trying to use graphql api but while triggering api I am getting below error message. { "errors": [ { "message": "`variables` in a POST body should ...
  • 3,946
0 votes
1 answer
23 views

How to filter value from api response using rest Assured

I have a response json as below. where I have multiple nested json in an array having details of spends on particular channel. I need to get the spend value of "EMAIL" only. How can I check ...
-2 votes
0 answers
18 views

How to compare sql database resultset to api post method response [closed]

Can someone help me give a sample code to compare sql resultset against api post method response using java. I am having a test framework where am calling the method that contains resultset. But it's ...
  • 1
0 votes
0 answers
14 views

Using DataProvider receiving MethodMatcherException in Automated test

fairly new to this forum and writing automation tests but here it goes.... I am writing some automated tests for API calls - 200, 204, 400, 401, 403 etc in java / Maven project in IntelliJ. I am ...
0 votes
0 answers
40 views

Getting error in whole exisitng project(Rest assured)

package demoProject; import io.restassured.RestAssured; import io.restassured.path.json.JsonPath; import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; import org....
0 votes
1 answer
19 views

I have got BUILD FAILURE result when executing command

I am receiving error messages when trying to create a maven project through by executing the below command, in cmd.exe. mvn archetype:genrate -DgroupId=demoProject -DartifactId=Mavenjava -...
0 votes
0 answers
37 views

How can we convert a String variable into JsonString in restAssured

question-> here I want to convert the qciResponse variable into Json and fetch userId from qciResponse, how can we do that..? public String setRemoveLoginIdRequestBody (String awsEndPoint, String ...
0 votes
1 answer
35 views

Unable to pass raw JSON request body with response error "The browser (or proxy) sent a request that this server could not understand"

I am trying to make a GET request to the URI which has header Content-Type=application/json and has a request body which is a raw JSON type. Below is the code I am using with RestAssured API but it ...
0 votes
0 answers
21 views

How to convert Ciphertext value in to string

"payment": { "paymentMethodCode": "886", "billAccountNumber": "!110394383945", "bankCode": "7162", ...
0 votes
1 answer
30 views

DataProvider in TestNG with Builder pattern returns Data provider mismatch (Rest Assured)

I tried to implement builder pattern into my code and I'm stuck with DataProvider. When I'm tring launch test I get an error: org.testng.internal.reflect.MethodMatcherException: [public void api....
  • 13
0 votes
1 answer
34 views

Getting 401 response code in rest assured tests

Im trying to fix my rest assured test, because after i added <dependency> <groupId>de.ruedigermoeller</groupId> <artifactId>fst</artifactId> &...
0 votes
1 answer
41 views

How to fetch value from api response using rest Assured

I am new to rest assured. I have a response json as below. where I have multiple nested json in an array having details of spends on particular Merchant. I need to get the spend value of Netflix only. ...
0 votes
1 answer
58 views

How to assert with current date?

Trying to assert an object and that object needs to be equal to the local date on whichever date the test is run. I have the following code: import java.util.Date; public class { float ...
  • 13
0 votes
1 answer
36 views

Error in extracting json response properties of hydra:collection using RestAssured Java

I'm extracting MailTM GET /domains API properties and need to extract the hydra:member from the following API response. { "@context": "/contexts/Domain", "@id": "/...
1 vote
1 answer
38 views

How to prevent ClassLoader leaks when using ClassValue?

For my tests, I'm using rest-assured which is partially written in Groovy. In my application, I use a custom ClassLoader to load rest-assured and Groovy classes, after each test, the ClassLoader is ...
0 votes
0 answers
16 views

I have included all the dependencies in POM.xml, I am getting symbol not found error while "mvn install"

I am new to maven. Please help! Even if I have included all the dependencies in POM.xml, I am getting symbol not found error while "mvn install". Here is the complete stack trace for your ...
0 votes
0 answers
118 views

[RestAssured][Allure] Could't render http attachment file

I have a problem with my test suit. After made a request I didnt see response in logs and Allure can not render http attachment file. Only have request body in logs I use Java 17 and suit is building ...
  • 1
-1 votes
2 answers
71 views

How to continue the test Execution after failing by assertion

response = res.when().post(a.getGetBankAPI()).then().extract() .response(); //Thread.sleep(1000); int statuscode = response.getStatusCode(); System.out.println(statuscode); try { Assert....
0 votes
1 answer
25 views

Getting 407 Authorization error while executing RestAssured code after providing custom proxy details

I'm new to API testing using Rest Assured. As I'm working behind the proxy, I have used all the proxy details in the code. Below is the code I'm trying to execute. Getting 407 error. ...
  • 1
0 votes
1 answer
26 views

How to handle If else condition in rest assured

Description: I have made two different class methods, setpassword and resetpassword. If my resultStatus and resultMsg is "F" and "PASSWORD_NOT_EXIST" in resetpassword class method, ...
0 votes
1 answer
23 views

When using Rest Assured, if I send a post request to summit data to server, how can I write "ABC":["XYZ"] this value in LinkedHashmap

Request body is:- { "request": { "body": { "ABC":["XYZ"], "PASSWORD": "password" } } MY CODE:- I am getting error in response ...
0 votes
1 answer
171 views

Why does my rest-assured code not work after moving to JDK 17

We are building REST API with tests. The API runs perfectly and we don't have any issue with it. The errors we am getting are in the testing part. The tests uses Rest Assured library. We have to use ...
0 votes
1 answer
58 views

Parameter was used but not defined

Trying to retrieve an item from a response object for validation but getting an error. What am I doing wrong ? My code: @And("^Delete record for member 0000000555for SC_1_1 scenario") public ...
  • 13
0 votes
0 answers
26 views

How to validate dynamic response structure & data for a GraphQL service using Rest Assured

I am new to Rest Assured & GraphQL service. I have a test requirement where I need to validate the address data in JSON response received for multiple PIN codes & fieldnames sent in the ...
1 vote
0 answers
24 views

Stub is not returning the mocked recponse for QueryForParamater request

Trying to mock the QueryForparamater response but message as 'Request was not matched'. tried with below different ways but getting same result. Can anyone correct me to unblock? ...
0 votes
0 answers
13 views

How do I send form-data in rest assured with content type as multiparts with boundaries

here are the headers here is the data which is in text form that i want to send as payload
0 votes
1 answer
31 views

Multiple Java IF statement writing a JSON response to Excel using Apache Poi XSSF

I have a test that returns a JSON response some if the responses might return nulls depending on the tests for example the response path will look like data.test1[0] data.test1[1] data.test1[2] data....
  • 165
0 votes
0 answers
38 views

unable to upload ZIP using rest assured

I am trying to hit an API which consumes MULTIPART_FORM_DATA and reads a file from the request. i am using below rest assured code to hit my API. it gives me error. but the same works with POSTMAN. ...
  • 81
0 votes
1 answer
26 views

How to compare two JSON fields in RestAssured and Hamcrest?

I'm using RestAssured and Hamcrest to functional test our Back-end API and I'd like to know if there's any way to compare two distinct JSON fields inside the body method, or any equivalent. For ...
0 votes
1 answer
56 views

how to convert nested json payload into for Restassured POST call using Map?

{ "@serviceName": "75MultipleService", "inputs": [ { "@name": "inp1", "value": "8", ...
0 votes
1 answer
32 views

Getting response as session expired for and API

I have two classes DB_Search and Elastic_Search which generate the response from STAGE and PROD, but when I ran these two classes parallel using the testng.xml file, one class got a complete response ...
  • 15
0 votes
0 answers
34 views

java.lang.NoClassDefFoundError: Could not initialize class com.jayway.restassured.RestAssured

I am getting this error, test cases are getting failed, while upgrading the application to Java 17. I am using dependencies : com.jayway.restassured:rest-assured:2.8.0 com.jayway.restassured:json-...
0 votes
0 answers
43 views

How to fetch session Id in Rest Assuered

I am trying to fetch session id of the user but the session id is coming as null. Below is the sample code I have used RestAssured.baseURI="https://demo.com" Response response = RestAssured....
0 votes
1 answer
57 views

Json is not extracted to Java POJO object

I'm using rest-assured with Gson for testing when getting a response from the BE service I'm creating a POJO object that deserializes the JSON and creates and object, but for some reason all object ...
  • 189
1 vote
1 answer
64 views

Refresh Token Rest Assured

I am performing some test that needs to have a token in order to working on the application, the token get expired after 15 minutes, I have a method in order to refresh the token, the first time, the ...
1 vote
1 answer
28 views

rest-assured with pfx file always returns 401

From this source: RESTAssured - use .pfx certificate for https call I created below. @Test void testPfxKey() { // Source: https://stackoverflow.com/questions/42235588/restassured-use-...
  • 11
0 votes
0 answers
28 views

RestAssured, H2, SpringBootTest Transaction Management. Persisted data not available when calling REST Interface

I wrote a simple SpringBootTest where I tried to read test data from a JSON file and insert it into the database in the @BeforeEach annotated method. When querying the data in the test method, I ...
  • 23
0 votes
1 answer
76 views

Failed to parse the JSON document: Request successfully return 200 response but response body isn't printed in Log file

I got an exception with validating "status": "OK" in the response body of the DeletePlace request. Request is successful with 200 status code but there is no response body in the ...
0 votes
1 answer
79 views

Cannot invoke "PacienteService.findById(java.lang.Integer)" because "this.service" is null

I'm trying test a RestAPI in Java, but I can't mock my Service class When start test, it gives me an error: java.lang.NullPointerException: Cannot invoke "com.tcc.tccbackend.services....
  • 5
0 votes
1 answer
95 views

Why do we need to use POJO class and serialization in RestAssured, when we can directly send request body in the form of String?

What is the realtime use case for serialization in RestAssured? Even though we can send request body(JSON) as String. I tried googling but did not get satisfying results.
  • 7
0 votes
1 answer
76 views

How do I match items in a list from an anonymous root from a RestAssured body?

I have this output [ {"name": "a"}, {"name": "b"} ] And the following code given() .get("endpoint") .then() .body("$.name", hasItem(&...
  • 337
0 votes
0 answers
64 views

How to get json key values by another key value

I have a JSON output like this: { "items": [ { "id": "1", "name": "Anna", "values": [ ...
0 votes
1 answer
55 views

How extract response to String and save it to variable

Being new to Java/JSON/REST Assured topics, I would like to extract a parameter of "token": from a JSON response body as a String and store it as variable which I could take to some other ...
0 votes
1 answer
84 views

Getting 'java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection' while connecting oracle database

I'm facing oracle database connectivity issue while running my automation script thru jenkins pipleline whereas it is working fine when I run the script in local. Error Log: java.sql....
0 votes
0 answers
125 views

Why i received a null when i testing Post method in Spring Boot

jakarta.servlet.ServletException: Request processing failed: java.lang.NullPointerException: Cannot invoke "com.kraievskyi.task.model.Product.getId()" because "product" is null at ...
0 votes
0 answers
96 views

API automation - Cucumber extent report 7 - capture request and response log in HTML report

I have created a API automation framework and using cucumber extent report I could generate the HTML report with result status @RunWith(Cucumber.class) @CucumberOptions(features="postrequest....
0 votes
1 answer
154 views

how to convert nested payload into Java-JSONObject (net.minidev.json.JSONObject) for Restassured POST call

How to convert below nested payload into Java-JSONObject (net.minidev.json.JSONObject) for Restassured POST call request body ? { "object": "new_subway_group", "name"...
  • 1,787
1 vote
1 answer
61 views

RestAssured OAuth1 authentication problem (Twitter v2 API) in Java

I am trying to make a request to Tweeter with OAuth1 authentication method in Python I manage to do it with requests library but on Java I use Rest assured. Following code does not work, its return ...
  • 101
0 votes
0 answers
21 views

IntelliJ:Rest Assured getting missing input or config

Can anyone help me Project has been cloned from Bitbucket and locally when i am running the project in the intelliJ the error is displayed Unable to run the scripts-rest assured in the IntelliJ ...
0 votes
0 answers
30 views

Assertion failing even though the values seem to match

public void ClaimValidation() { float validateMemberPay = S3_1Response.jsonPath().get("planCopayAmount"); softAssert.assertEquals(validateMemberPay, 300.00); float validatePlanPay =...
  • 13

1
2 3 4 5
44