79 questions
0
votes
1
answer
676
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(&...
0
votes
1
answer
221
views
What will be the GPath expression for Rest Assured
I have tried to create GPath expression with filter criteria to return "my-notes" in list of object when '"my-type"' is SPECIAL
like : '"data.my-node.nodes.findAll{it.'my-type'...
0
votes
1
answer
40
views
I need to send the request correctly, but I don't know how to get the required values from objects
How to get a new list from the list of objects?
I need a new list of objects to POST request
this list of objects i get from response:
{
"success": true,
"body": {
"...
0
votes
1
answer
443
views
How to get the summation of values using gpath sum() in restassured on JSON Object
I was trying to find the summation of deceased count from JSON object extract from the following JSON response
https://api.covid19india.org/state_district_wise.json
Snippet from above is json
"...
1
vote
2
answers
979
views
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
{
"locationType": "STORE",
"...
1
vote
1
answer
1k
views
How to get relative path using Groovy Gpath in json?
I am using rest assured with Serenity BDD and using Groovy Gpath to navigate thru JSON. Now, I have a scenario like where I need to get the Cost values more than 2 with below JSON. is there any way to ...
2
votes
1
answer
342
views
Groovy : Class.forName().newInstance() error
I have this following method in which I return a List<ImField> object using the List<GPathResult> filteredList. I perform filteredList.each closure where I generate
class at runtime and ...
0
votes
1
answer
584
views
How can i get a max value for userId from this rest endpoint? I have to use RestAssured with Gpath syntax
I have to get a max value for userId using RestAssured and Gpath syntax. I dont know what i should type in body after then.
I have tried so many ways but it does not work.
@BeforeClass
public void ...
0
votes
1
answer
447
views
RestAssured Json response verification with GPath
I receive the following response on a bad request against my API. I am using RestAssured for my rest response assertions.
{
"message": "An entity of type topic was passed in an invalid format",
...
0
votes
1
answer
2k
views
How to search in anonymous and nested array using find or findAll in groovy's closures using REST-Assured library?
I have following JSON response anonymous body and I need to parse nested arrays dynamically to retrieve a key's value based on a condition by using find or findAll in the groovy's closures
[
{
"...
0
votes
1
answer
157
views
Move a node with Gpath
Given the data model
<outerTag>
<tagA>
</tagB>
</tagA>
<tagC>
<interestingContent>
...
</interestingContent>
...
0
votes
1
answer
124
views
GPath testing for decimal value
Using Rest Assured in Java to test some APIs. Trying to use GPath to return a value.
Why does this work?
int i = response.path("Result.find{it.Amount>293.50 && it.Amount<293.52 &&...
1
vote
1
answer
509
views
Finding a partial String match in an XmlPath expression using grep
I'm using RestAssured to help me with some testing.
Given the following XML:
<OptionalExtra ID="PREB" Description="Premium meal beef" Code="PREB" Supplier="PRI" FPC="extra.pax.flightmeal" Type=...
1
vote
1
answer
2k
views
Using XPath with GPathResult to find all nodes and add new attribute
Edited...
My knowledge in Groovy is basic and I need to perform the following action which I have no idea how to do.
let's say I have this XML:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap....
2
votes
2
answers
2k
views
Find XML Element by attribute value using dynamic GPath Expression
Following is a sample XML:
<root>
<persons>
<person gender="female">X</person>
<person gender="female">Y</person>
<person gender="...
0
votes
1
answer
1k
views
Groovy Get value of an XML attribute with GPath Slurper
Need to parse an XML document that contains attributes within a header context.
<?xml version="1.0" encoding="UTF-8"?>
<S38:manageRequest xmlns:S38="http://ns.com/S38" xmlns:header="http://...
0
votes
1
answer
1k
views
GPath on nested objects
I'm not sure what I'm doing wrong here and I'm having a hell of a time with getting this to work properly. Using this JSON:
{
"books": [
{
"category": "reference",
...
2
votes
1
answer
6k
views
Rest assured, using Gpath query gives an error "The parameter "..." was used but not defined. Define parameters using the JsonPath.params(...)"
I'm new to rest-assured and I'm currently spiking it in order to implement it in our testing framework.
The problem I'm facing is to extract an object from a Json array from the REST response.
The ...
1
vote
1
answer
2k
views
Escape dots in Groovy GPath
I am using the RestAssured framework in Java, whose documentation contains this note
Note that the "json path" syntax uses Groovy's GPath notation and is not to be confused with Jayway's JsonPath ...
1
vote
1
answer
961
views
Rest assured path not able to access element with number in path
In the following (partial)JSON response:
{
"costPrices": {
"3226186": [
{
"fromDate": 1420066800000,
"toDate": null,
"product": {
I'm ...
0
votes
0
answers
975
views
Groovy GPath find all children nodes by condition
Given this XML
<?xml version="1.0" encoding="UTF-8"?>
<data>
<level0 id="1" t="0" l0id="0">
<level1 id="lev1id01" att1="2015-05-12" val="12" status="0" year="2015" ...
2
votes
2
answers
1k
views
Groovy GPath find nodes by many conditions
Suppose having XML:
<?xml version="1.0" encoding="UTF-8"?>
<data>
<level0 id="2" t="1">
<level1 id="lev1id21" att1="2015-05-12" val="121" status="0" year="2015" month=...
2
votes
1
answer
875
views
Find maximum value of attribute with Groovy XmlSlurper
Given xml:
<d>
<r1 dt="2011-06-10">
<r11 dt="2012-07-10" />
<r12 rdt="2011-10-11">
<r121 dt="2010-05-13" />
</r12>
</...
1
vote
1
answer
575
views
Groovy GPath with variable in it
with the XML code below:
def soapResponse = "
<Results>
<ResultSet fetchSize="10">
<Row rowNumber="1">
<ID_ORDER>144107</ID_ORDER>
<...
2
votes
2
answers
3k
views
groovy Print path and value of elements in xml
I have the following xml:
<list>
<cars>
<model>2012</model>
<make>GM</make>
</cars>
</list>
I want to print these values as ...