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

TestNG parametrization pass in method

I'm wondering is it possible to put parameters in method when I use testng.xml. I know about put parameteres in test class. I use page object model approach. Here is my code
goney225
  • 91
  • 1
  • 1
  • 10
0
votes
0 answers

Rest assured + properties baseURI cannot be null class not loaded

I have ConfigProperties.class public class ConfigProperties { @BeforeTest public void TestDataSetup() throws FileNotFoundException { File src = new File("src\\main\\resources\\config.properties"); FileInputStream fis = new…
goney225
  • 91
  • 1
  • 1
  • 10
0
votes
1 answer

Rest Assured execption class io.restassured.path.xml.XmlPath cannot be cast to class java.util.ArrayList error

Im working on Rest Assured project and I want to get speciific part of response body but Im getting exception: Exception in thread "main" java.lang.ClassCastException: class io.restassured.path.xml.XmlPath cannot be cast to class java.util.ArrayList…
Kos
  • 1
  • 1
  • 2
0
votes
0 answers

Retrieve last row values from Cassandra, increment it and pass it back to db using post payload

I connected to Cassandra database using Java and able to query and read all the values as per my query. What i want to do now is Write a logic to scan the table and fetch the values of the last row which is SeqNo 3 in this case Once i fetch these…
Sam1977
  • 15
  • 4
0
votes
0 answers

REST-assured JSON output

I am trying to retrieve a JSON file, but it doesn't seem to be a JSON file, but it outputs application/json 12:39:39.403[main] DEBUG org.apache.http.wire - <<…
0
votes
1 answer

Java/REST-assured: how to use SSL certificate in code

I'm trying to use REST-assured to do some API calls for which SSL authentication is required. I have received: .p12 file password .cert.pem file .key.pem file When I put all this in e.g. Postman, it just works. Now I want to use this in my Java…
Gandalf
  • 11
  • 1
  • 4
0
votes
1 answer

Failure when asserting bad request with rest-assured

I want to assert a bad request if I request with a wrong parameter. Here is my test code: RestAssured.baseURI = "xxx.xxxx.xxx" requestSpecification = RestAssured .given() .relaxedHTTPSValidation().when() …
0
votes
1 answer

How to send -d information in rest assured?

I am trying to automate an api which has -d information which needs to be sent. curl request looks like this- curl -X PUT "https://XXXXXXX.com/v1/YOLO/cccc/abc/mom" -H "accept: */*" -H "Content-Type: application/json" -d "[10035]" I am not able to…
Sobhit Sharma
  • 697
  • 14
  • 45
0
votes
1 answer

REST Assured: compare field to a long value

Consider this line: response.body("path.to.some.long",is(getExpectedResult()) What I'm getting is: java.lang.AssertionError: 1 expectation failed. JSON path path.to.some.long doesn't match. Expected: is <1500L> Actual: 1500 Does that mean REST…
IsaacLevon
  • 2,260
  • 4
  • 41
  • 83
0
votes
1 answer

How to extract json Response in rest assured with points in key

To extract status form this response in rest assured i just need to use one.response or two.response { "one": { "status": "SUCCESSFUL", "fileNum": "1" }, "two": { "status": "SUCCESSFUL", "fileNum": "2" }} But how can I extract the…
VSs
  • 61
  • 4
0
votes
1 answer

JsonPath (Rest Assured): Get a JsonPath out of JsonPath

Is it possible to get a new JsonPath object out of a current one? The only thing I've found is setRootPath() but that's not exactly what I'm looking for since you cannot "go back" once you've set the root. My use case: I have a JSON array of…
IsaacLevon
  • 2,260
  • 4
  • 41
  • 83
0
votes
1 answer

REST assured throws SSLPeerUnverifiedException: peer not authenticated

I have a service that exposes an API which I'd like to test. I'm running the service on localhost and it has a self-signed certificate. I added the .p12 file to test/resources and on @BeforeAll: RestAssured .config() …
IsaacLevon
  • 2,260
  • 4
  • 41
  • 83
0
votes
0 answers

Getting 302 on delete http method using rest ssured

I am new to rest assured testing. I am doing authentication using cookies and the GET call is returning a 200 status but when i am doing a delete, i am getting 302. What am i doing wrong? This works- public void Getcall(String id){ …
0
votes
1 answer

POST request in postman got 307, unable to reproduce in restassured

I have a POST request, which I tried first in Postman, I wanted to capture the status code before it's redirected. In Postman, I got 307 (I set the settings so it doesn't follow redirects). Postman But when I tried using restassured, it still got…
Far
  • 1
0
votes
0 answers

How to fetch json object from a specific column in mysql for below query

In the below query SELECT grouped_target_tuple FROM targeting_template_target WHERE targeting_template_id='5863' AND…