Forum Discussion
Hi richie ,
Thanks for being so articulate. I have people who have implemented the solution ,although i need to lay down the basic groundwork inorder to reach them .The team has allowed me to involve in upgrading my skills and also are open to other solutions such as getting the data from the UI in excel format .
Another solution is to validate JSON response with the JDBC Step . Can you please help me with this ?
I have my JSON Response something like this :
(Can't provide actual data for security purposes but this is the response and they are severeal of these based on the request)
{
"$id" : "1",
"$type" : "XYZ",
"FeatureName" : "XYZ",
"FeatureQuantity" : 1,
"ToolFamily" : "XYZ",
"IsPrimary" : true,
"SupplierName" : "XYZ",
"ProductCode" : "XYZ",
"Description" : "XYZ",
"ToolIsActive" : true,
"FeatureIsActive" : true,
"IsRemixable" : true,
"IsAnnualized" : false,
"ListPrice" : 10500.00000000,
"ModifiedBy" : null,
"ModifiedDate" : null,
"CatalogId" : 21774,
"Features" : "XYZ",
"ProductType" : "A-la-carte"
},
And with the help of the developer i have got the query that gives the response to certain fields from this and there are multiple records and vary with data required . Can you please provide any familiar way to validate such requests and the response can have n number of entries and have only numbers for nodes but i want to extract only the data that i need and have to validate it with the jdbc response . Let's say i have both can you please provide a solution to validate the same .
Please let me know if there is anyway i could connect i terribly need to get this done by today .
Where's this json response come from?
Executing a JDBC step returns results in xml format. If youve got this response from an HTTP/ReST step we can convert the response to xml by adding an 'Accept' header with value of 'application/xml' to convert the response to xml instead of json so both HTTP and JDBC responses are same datatype.
You state ".......and the response can have n number of entries and have only numbers for nodes but i want to extract only the data that i need and have to validate it with the jdbc response"
Firstly can you clarify what you mean by "....have only numbers for nodes"? I dont know what you mean by this.
Where you say ".....but i want to extract only the data that i need and have to validate it with the jdbc response". I'm a bit confused. You can add filters to your SQL (in the WHERE clause of your SQL query) to control what is returned by your JDBC query, however, if youre attempting to prove the storedproc works correctly then adding filters to your SQL query to retrieve specific info that doesnt match what the storedproc retrieves exactly wont verify the storedproc is working correctly.....or am i misunderstanding something?
Oh, one more question: does your database support querying via HTTP/ReST as an alternative to querying via JDBC/SQL?
Cheers,
Rich
- krispokkuluri4 years agoOccasional Contributor
Hi richie
Where's this json response come from?
I ran a REST API call to the Application API (Grid based Application ) than the stored proc and received the JSON response . As you can see the response nodes are individual numbers and there is no global node which making it hard to get as a data source and then validate with the JDBC response . My idea is something like this as i have very less time at hand . I would appreciate if there is any script suggestion that could help here . I have attached the two responses below .- Hope this helps to clarify Also would appreciate if you could provide a world view to the same as in what could be the best practice to validate the Response from this application in general.
P.S: I need a dynamic solution as the data that i will be validating would only increase in number can't keep individualy adding data for each node .
This is the JDBC Step:
- richie4 years agoCommunity HeroHey krispokkuluri,
Ok. Now i am confused.
On your initial post you stated that you had a storedproc which you needed to verify was working correctly and you suggested creating an SQL query to match the storedproc requirements to verify the storedproc worked correctly.
What youve described in this most recent post is entirely different.
You gotta remember i dont know what you do, i dont know what youre working on and on top of that, im really dumb, so you need to explain everything from scratch.
From your most recent post you state:
You ran a REST request, then ran the storedproc and the storedproc returned a json response.
Q1. what is the purpose of the REST request?
Q2. What is the purpose of the storedproc?
Q3. Is the storedproc doing something to the data retrieved in the REST request?
Q4. Are you saying the storedproc returns a json rather than xml payload?
Q5. Can you please attach rather than embed the screenshots? I cant see whats going on with embedded screenshots.
Sorry to be a pain asking all these questions, but unless i completely understand i wont be able to help!
Nice one!
Rich- krispokkuluri4 years agoOccasional Contributor
Hi richie
Apologies for the misunderstanding !!
Context : We are trying to build an API automation test suite for a Grid based Application where in we input certain parameters and recieve data in the form of a grid like this :
This is the application frontend it works on the basis of stored Procs that are written which are called when a particular functionality is called and drops the data for the particular parameter . This is what we do validate manually for now and we would like to automate the same hence API Automation felt like a natural step .
Q1. what is the purpose of the REST request?
A) REST Request is used to interact with the application to recieve the responses based on the request and we are looking to validate the same .
Q2. What is the purpose of the storedproc?
A) Purpose of the stored proc is to run when a related api call is called to throw the requested data .
Q3. Is the storedproc doing something to the data retrieved in the REST request?A) No It is what is throwing the data to the frontend
Q4. Are you saying the storedproc returns a json rather than xml payload?A) Stored proc return XML payload only . I can validate using the stored proc or json (We utilize it based on the scenario)
Q5. Can you please attach rather than embed the screenshots? I cant see whats going on with embedded screenshots.attached
A) The Ask is to validate the data treating them as individual objects by either callind the REST request or the Stored Proc and write a custom query to get similar data and validate the same . This is the proposed approach .
Questions:
1) What i am looking for is your understanding of the design and feasibility of the same . Does it make sense in real world QA to validate in this way if yes then fine if no then please state your opinion .
2) Can you please tell me how i can implement the same in a short way that gives me a quick validation and a more logical way that would be dynamic and covers longer range
Related Content
- 8 months ago