Hi Everyone,
This is my very first post on this forums. I’ve been using SenseTalk|Eggplant for more than a week. I’ve written a little over 500 lines of code to run automated tests.
So far so good. I’ve decided that before I continue with more complex and longer milestones in my test automation script I want to really understand my options with this code.
I want to know if a list of can reference another list. If yes, how do I access the the ‘sublist’. The syntax looks correct. But I am having problems accessing / reading the ‘sublist’. See code below:
Set ItemList = {
(found:false,foundAt:0,name: "item1",image: "item1.png",sublist: itemList1),
(found:false,foundAt:0,name: "item2",image: "item2.png",sublist: itemList2),
(found:false,foundAt:0,name: "item3",image: "item3.png",sublist: itemList3)
}
Set itemList1 = {
(found:false,foundAt:0,name: "sub1_item1",image: "sub1_item1.png",),
(found:false,foundAt:0,name: "sub1_item2",image: "sub1_item2.png",),
(found:false,foundAt:0,name: "sub1_item3",image: "sub1_item3.png",)
}
Set itemList2 = {
(found:false,foundAt:0,name: "sub2_item1",image: "sub2_item1.png",),
(found:false,foundAt:0,name: "sub2_item2",image: "sub2_item2.png",),
(found:false,foundAt:0,name: "isub2_tem3",image: "sub2_item3.png",)
}
Set itemList3 = {
(found:false,foundAt:0,name: "sub3_item1",image: "sub3_item1.png",),
(found:false,foundAt:0,name: "sub3_item2",image: "sub3_item2.png",),
(found:false,foundAt:0,name: "sub3_item3",image: "sub3_item3.png",)
}
Repeat with each item of ItemList
Set I = repeatIndex()
logSuccess (item I of ItemList).name &", " & (item I of ItemList).image & ", " & (item I of ItemList).found & ", " & (item I of ItemList).foundAt
(* This part gives me an error: *)
Set Sublist = (item I of ItemList).sublist
Repeat with each item of Sublist
Set II = repeatIndex()
logSuccess (item II of SubList).name &", " & (item II of SubList).image & ", " & (item II of SubList).found & ", " & (item II of SubList).foundAt
End Repeat
End Repeat
I’ve tried several ways to try to access the sublists unsuccessfully.
Error I got:
12/22/16, 9:04:44 AM START Running nestedList_test.script
12/22/16, 9:04:44 AM LogSuccess item1, item1.png, False, 0
12/22/16, 9:04:44 AM EndTestCase (Duration:“0.186”, Errors:“1”, Exceptions:“0”, StartTime:“2016-12-22 09:04:44 -0600”, Successes:“1”, TestCase:“nestedList_test.script”, Warnings:“0”)
12/22/16, 9:04:44 AM FAILURE STUnknownMessage ERROR: No Such Function: ‘name’ – Execution Time 0:00:00 nestedList_test.script
The purpose of having lists referencing other lists is because I want to loop or repeat through elements of a list (to validate they loaded) and after that make an action with each element and for each action you usually have another screen and another set of elements to validate and so on. In other words, I want to iterate on elements on a list, and jump to a different set of elements to validate as well, branching off the initial list.
What I am try to do sounds more complicated that it would actually be and it will my coding task easier.
Any ideas? Suggestions that can put me in the right direction?