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

How to send form-data as text using Rest Assured

how do I send form-data as 'Text' via Rest Assured, please refer to the screenshot. When I use request.multipart("key"."value") request is being sent as file( refer screenshot ). TIA.
0
votes
1 answer

RestAssured -> Error handling on QueryParameters

// I am using RestAssured with Java. // I want to validate if my No 1 service fails and can't get the account number how can i use my hard //coded account number from no 2. Can someone help me on what error condition or strategy i can use? // …
Sam1977
  • 15
  • 4
0
votes
2 answers

Trying to bring back the id of an API response expected and actual match?

I have been playing around testing an api I've looked for ID 24 in my test and my actual and expected are the same I'm assuming I'm using the incorrect syntax where I have .body what should I put in place instead? @Test public void…
0
votes
2 answers

How do i limit the number of array elements retrieved by a GET request (REST API JAVA)

Supposedly, My API retrieves JSON having around 100 ids and its respective values. How do i limit it to first 10 ids with its values? Is there any JAVA code to limit this? [ { "id": 1, "name": "Leanne Graham", "username": "Bret", "email":…
Sam
  • 1
  • 1
0
votes
2 answers

Rest assured - how to pass token by headers and where did I wrong?

I am able to log in a user and the response returns the token which I store in token variable then I try to pass the token that I received but the system returns 403 all the time. Where I got wrong or how it should look like? @Test public void…
0
votes
1 answer

TestNG: Is it possible to use DataProvider in AfterTest(), AfterClass(), AfterMethod()?

I am writing few test in which I am using DataProvider for @Test and creating few thing now as a cleanup/teardown() step I want to delete these things in @After methods, how can I use DataProvider in AfterTest(), AfterClass(), AfterMethod() ?
ssharma
  • 935
  • 2
  • 19
  • 43
0
votes
1 answer

Authorization Bearer token is not included for request

I am trying to run my autotests with serenity and rest-assured, but the token is not included in my request generation method. The method of getting the token itself works correctly. tell me what could be the reason. public class ApiSteps { …
Maria
  • 3
  • 2
0
votes
0 answers

Rest Assured Trying to Post Multiple Files Formats But Receive 415 Response Code

I'm trying to post several files, the API endpoint accept a file and json File, but I Receive a 415 Response Code @Test(enabled = true) public void testResp(){ RestAssured.given() .baseUri("http://localhost") …
0
votes
1 answer

Can we use io.restassured and jayway in the same method?

When I have arrays in response, getting proper results using Jayway, but not with io.restassured ? Can I use Jayway and io.restassured together ? Is that an acceptable / good practice? JSON Response : {"applications": [ { "Id":…
learningIsFun
  • 142
  • 1
  • 9
0
votes
1 answer

Rest-Assured - How to validate response body with POJO

I'm freshman in Rest-Assured. I have a simple test which gets response body and I want to validate whether the response body matches with my POJO class. Here is my test: @Test public void getMySmartPlansList() { MySPList mysp = new…
Villa_7
  • 508
  • 4
  • 14
0
votes
1 answer

SpringSecurity using memory authentication don't returns error 403 in http put method

I don't receive the error 403 in http "put" method using SpringSecurity in memory authentication. The method returned 200 when it should return 403. The same code using http "post" method works normally. Note the exemple: The Websecurity…
0
votes
1 answer

How to retrieve jsonObjects from a arraylist api response in Java

How to get jsonObjects from this below rest api response, using restAassured and java. My rest api is returning response as below. [ { "id": { "value": "1" }, "fieldName": "input", "jobId": "234" …
Venu
  • 3
  • 2
0
votes
0 answers

Request Specification is changing Object to String for query params

In the request specification trying to add query params using the Map but after the request spec gets generated any value in th Object is getting converted to String even if the value passed in Int or anything else public Response…
Shaswat
  • 41
  • 1
  • 9
0
votes
0 answers

Test via Rest Assured returns 404 instead of 200

While validating a call using Postman and WireShark I can see a success response with status code 200 but when I try using Rest Assured I am getting a 404 error code Below is the error
0
votes
1 answer

Illegal query at Index 244

I am new to REST API automation. I have tried one code for OAuth 2.0 . I have written the code as instructed, I guess :) . After that I found the error. I have understood the cause of the error but couldn't find resolution for the same. Please help…
1 2 3
99
100