Search by a particular node
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2013
04:14 AM
04-08-2013
04:14 AM
Search by a particular node
Hello I was wondering if someone can help me with a problem i have encountered. I'm new to groovy scripting and I want to make an assert for the following json :
{"settings": {"bike_settings": [{
"drive_unit_id": "sndu20000011",
"bike_weight": 15,
"equipment_weight": 50,
"wheel_size": 50,
"name": "bike",
"wheel_size_correction_factor": 0,
"custom_assistance_levels": [
{
"max_torque": 30,
"point1": "0,1",
"point2": "2,30",
"point3": "3,40",
"point4": "4,50",
"point5": "8,0",
"level": 2
},
{
"max_torque": 30,
"point1": "0,1",
"point2": "2,10",
"point3": "3,40",
"point4": "3,5",
"point5": "8,0",
"level": 4
},
{
"max_torque": 30,
"point1": "0,1",
"point2": "2,30",
"point3": "3,40",
"point4": "3,5",
"point5": "8,0",
"level": 1
},
{
"max_torque": 29,
"point1": "0,1",
"point2": "2,30",
"point3": "3,40",
"point4": "4,50",
"point5": "8,0",
"level": 3
}
],
i want to verify that for level 4 the value for point4 is 3,5 but so far i could not store the node for level 4 and to verify that for that node the value for point 4 is 3,5
Does anyone know how to do this
thank you
{"settings": {"bike_settings": [{
"drive_unit_id": "sndu20000011",
"bike_weight": 15,
"equipment_weight": 50,
"wheel_size": 50,
"name": "bike",
"wheel_size_correction_factor": 0,
"custom_assistance_levels": [
{
"max_torque": 30,
"point1": "0,1",
"point2": "2,30",
"point3": "3,40",
"point4": "4,50",
"point5": "8,0",
"level": 2
},
{
"max_torque": 30,
"point1": "0,1",
"point2": "2,10",
"point3": "3,40",
"point4": "3,5",
"point5": "8,0",
"level": 4
},
{
"max_torque": 30,
"point1": "0,1",
"point2": "2,30",
"point3": "3,40",
"point4": "3,5",
"point5": "8,0",
"level": 1
},
{
"max_torque": 29,
"point1": "0,1",
"point2": "2,30",
"point3": "3,40",
"point4": "4,50",
"point5": "8,0",
"level": 3
}
],
i want to verify that for level 4 the value for point4 is 3,5 but so far i could not store the node for level 4 and to verify that for that node the value for point 4 is 3,5
Does anyone know how to do this
thank you
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2013
07:23 AM
04-09-2013
07:23 AM
Hi!
Generally, groovy scripting is not covered by our support agreement, but a good start is to use a JsonSlurper to parse your JSON.
Here's a link to a good tutorial on doing assertions on JSON in SoapUI. I hope you'll find it useful
http://www.robert-nemet.com/2012/08/jso ... oapui.html
Let me know if you have any further questions.
Regards,
Arian
SmartBear Sweden
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Generally, groovy scripting is not covered by our support agreement, but a good start is to use a JsonSlurper to parse your JSON.
Here's a link to a good tutorial on doing assertions on JSON in SoapUI. I hope you'll find it useful
http://www.robert-nemet.com/2012/08/jso ... oapui.html
Let me know if you have any further questions.
Regards,
Arian
SmartBear Sweden
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
