I am new to rest assured. I have tried below code for getting response This is JSON response How do I get the length or size of the elements of that array. Answer As above comment, the length here is the number of key-value pair in the json object. For me, you can choose any object in the array to
Tag: rest-assured
How To Use Response value In Another Method
I am working on restassured and here is my 2 methods. I want to use the albumId returned from the AlbumList method in the other method I know these are void and doesnt return anything but idk how to use it. Bye the these methods are in the same class. Thanks in advance } Answer The easiest way is to
RestAssured – TestNG “No tests found. Nothing was run”
I want to test my api’s use RestAssured with TestNG but i got some error’s.”No tests were [TestNG] No tests found. Nothing was run”. So here is my pom.xml file and testng.xml file. Pom.xml testng.xml testNG Configuration Part of my main class Thank you for your time Answer Ok i remove the psvm and i just use public void instead
I’m receiving an java.lang.AssertionError in a test using REST Assured
This is the first time for me using Gson and REST Assured, and I am really struggling to be honest. I need to verify that the content type is JSON and it is, but the test fails with the following message that you will see below. I am not writing all the imports that I have, if it is needed
Rest assured test failed with error “at java.base/java.util.ArrayList.forEach”
Every time I want to run my test it returns me an error in line that contains RestAssured.given() I tried different code examples from every where and every time it returns the same error in the same line that contains RestAssured.given() this is my code and this is the error returned Answer You’re probably using an older version of rest-assured
Rest Assured – JSON Schema Validation – java.lang.NoSuchMethodError: com.github.fge.jsonschema.core.processing.CachingProcessor
I have generated schema for the the JSON response and have stored it in project directory . No error shown in eclipse. But while running am getting below error. As it states method its looking for is not present. But I have imported the Jar which it shows as missing. Not sure if I am using incorrect version of that.
How to send HTTPS request with Rest Assured using .crt certificate and public .key token
I need to send https request with REST assured having client .crt certificate and public key .key How do I send request if my certificate and key in project like Answer
RestAssured – want to verify the body structure of JSON response in RestAssured
When i request for GET request, I’m getting the JSON response, but here my requirement is to validate the structure of response body. For example: The above response having structure, so i need to validate structure instead of one key value pair, how i can achieve this? Answer The best way is to verify json-schema matching. Firstly, you need to
Getting the value from the response element using GPath and Rest Assured
I want to get the value of status from my response. So that i can assert it. I’m using rest assured with java & serenity BDD. Response So, here the event id (66e326db-fbfb-4f6e-9d2b-9425e7test5) is dynamic, which means for each run this UUID will get change. Code When i run this, i’m getting Unrecognized Exception from serenity BDD. I think, that
How to avoid using milliseconds when using OffsetDateTime.now()
I am using OffsetDateTime.now() to get the current date in UTC format and result includes milliseconds too. I don’t want milliseconds to be sent . Is there a way i can remove Milliseconds from OffsetDateTime.now() without using split. Answer tl;dr Details The date-time classes such as OffsetDateTime are not strings. They do not have a format. Rather than thinking in