Creating a Data Source for a request that contains an array
I have a request that contains an array of account numbers that differs on every request (so it will not always be two account numbers sent), how to i store these values in a excel data source and set up the correlation? Here is the sample request:
{
"accounts" : [
{
"accountNumber" : "55555"
},
{
"accountNumber" : "66666"
}
]
}
Comments
-
Hello-Good-Morning Malindamiller!!!!!!
There's a few different directions we can go with this.
If you wish to use the extracted values as part of your correlation, you can use a JSON databank to extract the data and store it in a "Data Source Column" as shown below.Now, there IS a way to import your data into a CSV file using the almighty.....XPATH! The following article/discussion has a great tutorial on how to accomplish this. This article should also work for JSON. Give it a shot.
http://forums.parasoft.com/discussion/2698Once you've set up your csv datasource accordingly, you can then add the CSV-datasource to your Responder Suite which then you can use for correlation in the Data Source Correlation Tab within your Responder.
1 -
thank you for the response!
I like the databank method, although I cannot seem to figure out how to add one, I am using Parasoft Virtualize 9.9, is that outdated?0 -
Hello Malindamiller,
Out of curiosity are you using the Virtualize Desktop application or the Service Virtualization Thin client (Browser) in CTP?
1 -
the desktop application
0 -
Basically I need the request to be dynamic, so I can't use a sample request because then it will always need two account numbers.
0 -
Hi Malindamiller,
To answer your JSON Data Bank question, you will be able to add one if you right click your responder and click "Add Output". As shown in the images below.
I am trying to get a better idea of what you are looking for; however, I do not know how your response look. so I am only speculating for the time being. The solution I am proposing is different, but could be utilized for other means as well.
It looks as if you have this list of accounts:
{
"accounts" : [
{
"accountNumber" : "55555"
},
{
"accountNumber" : "66666"
}
]
}
and there is a mapping response for each accountNumber of the response.
{
"your_money" : [
{
"accountNumber" : "55555",
"amount" : "500"
},
{
"accountNumber" : "66666",
"amount" : "2000"
}
]
}Another example would be:
{
"accounts" : [
{
"accountNumber" : "55555"
},
{
"accountNumber" : "66666"
},
{
"accountNumber" : "77777"
}
]
}
With the response:
{
"your_money" : [
{
"accountNumber" : "66666",
"amount" : "2000"
},
{
"accountNumber" : "55555",
"amount" : "500"
},
{
"accountNumber" : "77777",
"amount" : "0"
}
]
}Note that I rearranged the elements here and added a new account element.
If this is the case, I would recommend that you use the multiple response generator in the Parasoft Marketplace. It is made to handle situations such as these. Documentation on how to use the response generator exist with the download.
0