How to access an array of object in a feature file for cucumber test?

37 views Asked by At

I have a json file that is used to do certain operations and later used to compare value. The json looks like the following

{
 "entity": {
  "userId": "0000",
  "pos": [
   {
    "posId": "1111",
    "userPosItem": [
     {
      "id": "3333"
     },
     {
      "id": "4444"
     }
    ]
   },
   {
    "posId": "2222",
    "userPosItem": [
     {
      "id": "5555"
     },
     {
      "id": "6666"
     }
    ]
   }
  ]
 }
}

I want to access pos[0].userPosItem[0].id but if written in a similar way in the feature file then I am getting an error.

The feature file looks like the following -

Then Topic published Event of type EventType and with
            |  entity.userId  | entity.pos[0].posId   |
            | {$model.userId} | {$model.pos[0].posId} |

The above check in the feature file of the cucumber test is generating error. It is also not possible to access the posId[0].userPosItem[0].id . How should I implement it?

0

There are 0 answers