I have a variable &{userList} and I've assigned the below value to it:
&{userList} id={rand_id} extension={rand_extn}
Then I am replacing the {rand_id} and {rand_extn} in my test case as:
${uni_id}= Generate Random String 2 [NUMBERS]
${uni_extn}= Generate Random String 4 [NUMBERS]
: FOR ${key} IN @{userList.keys()}
\ ${updated_val}= Replace String ${userList["${key}"]} {rand_id} ${uni_id}
\ Set To Dictionary ${userList} ${key} ${updated_val}
\ ${updated_val}= Replace String ${userList["${key}"]} {rand_extn} ${uni_extn}
\ Set To Dictionary ${userList} ${key} ${updated_val}
Now I wanted to create one variable which can have nested dictionary but I don't know how to do this. I am doing like this:
&{multipleUserList} id={rand_id} extension={rand_extn}, id={rand_id2} extension={rand_extn2}
And then I wanted to replace the values like this:
${uni_id}= Generate Random String 2 [NUMBERS]
${uni_extn}= Generate Random String 4 [NUMBERS]
${uni_id2}= Generate Random String 2 [NUMBERS]
${uni_extn2}= Generate Random String 4 [NUMBERS]
: FOR ${key} IN @{multipleUserList.keys()}
\ ${updated_val1}= Replace String ${multipleUserList["${key}"]} {rand_id} ${uni_id}
\ Set To Dictionary ${multipleUserList} ${key} ${updated_val1}
\ ${updated_val2}= Replace String ${multipleUserList["${key}"]} {rand_extn} ${uni_extn}
\ Set To Dictionary ${multipleUserList} ${key} ${updated_val2}
\ ${updated_val3}= Replace String ${multipleUserList["${key}"]} {rand_id2} ${uni_id2}
\ Set To Dictionary ${multipleUserList} ${key} ${updated_val3}
\ ${updated_val4}= Replace String ${multipleUserList["${key}"]} {rand_extn2} ${uni_extn2}
\ Set To Dictionary ${multipleUserList} ${key} ${updated_val4}
When I am running this and printing the values of ${multipleUserList}, I am getting values from ${uni_id2} and ${uni_extn2} but values of ${uni_id} and ${uni_extn} are not coming:
{u'id': u'60', u'extension': u'4858'}
Kindly help me in getting all the values. I am creating a body of the REST API when I've to create multiple user.