Forum Discussion

Musketeer's avatar
11 days ago

Data Source test step doesn't output arrays into properties

Hello! 

I am using Ready Api GUI 3.57.0 and I am trying to setup a modular, data-driven general testcase. I am using GUI only to setup the test, and now I encountered a strange situation when using Data Source test step

I have a nested array and I am currently trying to use JSON DataSource to iterate over the root array and save the nested array into a property. And I am failing to do so. When I point to the Array I want to save into the property, if saves Null. When I point to the first member (i = 0) of the array, it shows the data properly. 

Could anybody please help me check if I am the one who's doing something wrong, or it is ReadyApi being moody?

To make the situation more specific:

This is my JSON data source:               

 {
                    "name": "Get_PC",
                    "toTest": true,
                    "templatesDirectoryPath": "I:/Testing/AutotestSourceDataFiles/P1/Get_PC",
                    "a_webServiceDefinition":[
                        {
                            "name":"2018/05",
                            "toTest": true,
                            "webServiceUri": "/P1/2018/05",
                            "o_nameSpaceDefinitions": [
                                {"nsName": "soapenv", "nsUrl": "http://schemas.xmlsoap.org/soap/envelope/"},
                                {"nsName": "ns", "nsUrl": "http://www.data.com/2013/08"},
                                {"nsName": "ns1", "nsUrl": "http://ws.com/2018/05"}
                            ]
                        },
                        {
                            "name":"2023/09",
                            "toTest": true,
                            "webServiceUri": "/P1/2023/09",
                            "o_nameSpaceDefinitions": [
                                {"nsName": "soapenv", "nsUrl": "http://schemas.xmlsoap.org/soap/envelope/"},
                                {"nsName": "ns", "nsUrl": "http://www.data.com/2023/04"},
                                {"nsName": "ns1", "nsUrl": "http://ws.com/2023/09"}
                            ]
                        }
                    ]
                }

My DataSource test steps configuration is: 

Data Source Type: JSON
Step and property points to the aforementioned JSON string
Row Path: $['a_webServiceDefinition']
Column Path: ['o_nameSpaceDefinitions'] 

According to JSON PATH documentation and validators, the JSON PATH: $['a_webServiceDefinition'][0]['o_nameSpaceDefinitions'] should return the array I want, but it is returning NULL. 
Also, when I modify column Path to ['o_nameSpaceDefinitions'] [0], it correctly returns the first object in the array. 

Is there a problem on my side? 

No RepliesBe the first to reply