I defined the Post request with variable as below:
_ {_
_ “BrandName”: “${brandName}”,_
_ “Features”: {_
_ “Feature”: “${features}”_
_ },_
_ “Id”: “${id}”,_
_ “LaptopName”: “${laptopName}”_
_ }_
And in test case , I call the request :
_def features = \['2GB RAM', '3TB Hard Drive'\];_
_ WS.sendRequest(findTestObject(‘Post_AddFurniture’, [(‘brandName’) : ‘Test’, (‘features’) : features_
_ , (‘id’) : “5”, (‘laptopName’) : ‘Latitude’]))_
The actual result after execute test case, the “Feature” element contains one string “[2GB RAM, 3TB Hard Drive]”:
{
_ “BrandName”: “Dell”,_
_ “Features”: {_
_ “Feature”: [_
_ “[2GB RAM, 3TB Hard Drive]”_
_ ]_
_ },_
_ “Id”: 5,_
_ “LaptopName”: “Latitude”_
_ }_
But I expect the “Feature” element contains two string “2GB RAM” and “3TB Hard Drive”
{
_ “BrandName”: “Dell”,_
_ “Features”: {_
_ “Feature”: [_
_ “2GB RAM”,_
_ “3TB Hard Drive”_
_ ]_
_ },_
_ “Id”: 5,_
_ “LaptopName”: “Latitude”_
}