Behavior of Java Tree Children has changed
Posted: Fri Nov 21, 2014 3:31 pm
I just upgraded from 4.1 to 5.2 and am seeing a difference in how the Java Tree attribute "children" is validated.
I am unable to load the Spy Snapshot as it is over 1MB (Zipped)
So here is the output from the original test created using 4.1
01:09.629 Info Validation (Optional Action)
Validating AttributeEqual (children=$task_child_Order) on item 'Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks'.
01:09.692 Success Validation Attribute 'children' of element for item 'Smoke_TestRepository.Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks' does match the specified value.
and here is the output from the same test run using 5.2.0.20272
00:55.516 Info Validation (Optional Action)
Validating AttributeEqual (children=$task_child_Order) on item 'Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks'.
00:55.545 Failure Validation Attribute 'children' of element for item 'Smoke_TestRepository.Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks' does not match the specified value (actual='[2, 0, 1, 4, 3]', expected='(null)').
No changes were made in the code. I find it interesting that the "expected" (Which is passed by a variable from a spreadsheet) is a '(null)'.
I can see the value I want to compare in Spy at
/form[@title~'^Productivity\ Suite\ Progra']/container[@type='ContentContainer']/container[@type='MainContainer']//container[@name='DockedHiddenContainer']/container[@type='ContainerContainer']/?/?/container[@name='a']/container[@type='ContainerContainer']/container[1]/?/?/element[@name='Task Management']/?/?/container[@name='null.layeredPane']/container[@name='null.contentPane']//container[@name='viewport']/tree[@name='i']/?/?/treeitem[@text='Tasks']
Children [2, 0, 1, 4, 3]
Troubleshooting on this end, I converted the Test Step into User Code and stepped into it to verify the variable is being passed, exists and contains the correct data. In this case "[2, 0, 1, 4, 3]"
This is the code
This leads me to believe there is a problem with the implementation of the Tree object in this version of Ranorex. Our Java version has not changed and we install Java with our executable into it's own folder apart from the usual Java home.
Now instead of looking at all of the children all at once, I need to modify my code to iterate through the list and re-create what worked so well before, or revert back to 4.1 and continue as before.
I am unable to load the Spy Snapshot as it is over 1MB (Zipped)
So here is the output from the original test created using 4.1
01:09.629 Info Validation (Optional Action)
Validating AttributeEqual (children=$task_child_Order) on item 'Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks'.
01:09.692 Success Validation Attribute 'children' of element for item 'Smoke_TestRepository.Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks' does match the specified value.
and here is the output from the same test run using 5.2.0.20272
00:55.516 Info Validation (Optional Action)
Validating AttributeEqual (children=$task_child_Order) on item 'Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks'.
00:55.545 Failure Validation Attribute 'children' of element for item 'Smoke_TestRepository.Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks' does not match the specified value (actual='[2, 0, 1, 4, 3]', expected='(null)').
No changes were made in the code. I find it interesting that the "expected" (Which is passed by a variable from a spreadsheet) is a '(null)'.
I can see the value I want to compare in Spy at
/form[@title~'^Productivity\ Suite\ Progra']/container[@type='ContentContainer']/container[@type='MainContainer']//container[@name='DockedHiddenContainer']/container[@type='ContainerContainer']/?/?/container[@name='a']/container[@type='ContainerContainer']/container[1]/?/?/element[@name='Task Management']/?/?/container[@name='null.layeredPane']/container[@name='null.contentPane']//container[@name='viewport']/tree[@name='i']/?/?/treeitem[@text='Tasks']
Children [2, 0, 1, 4, 3]
Troubleshooting on this end, I converted the Test Step into User Code and stepped into it to verify the variable is being passed, exists and contains the correct data. In this case "[2, 0, 1, 4, 3]"
This is the code
try { Report.Log(ReportLevel.Info, "Validation", "(Optional Action)\r\nValidating AttributeEqual (children=$task_child_Order) on item 'Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.Tasks'.", repo.Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.TasksInfo, new RecordItemIndex(4)); Validate.Attribute(repo.Productivity_Suite.ProductivitySuiteProgrammingSoftware.DockedHiddenContainer1.Task_Management_Objects.Tm_Task_Tree_Items.TasksInfo, "children", task_child_Order, Validate.DefaultMessage, false); Delay.Milliseconds(0); } catch(Exception ex) { Report.Log(ReportLevel.Warn, "Module", "(Optional Action) " + ex.Message, new RecordItemIndex(4)); }Then I modified the code to read from the Tree. If I read from TreeInfo as noted above the list is empty and I do not see the Children. If instead read from the Tree item itself I can see the list of Children.
This leads me to believe there is a problem with the implementation of the Tree object in this version of Ranorex. Our Java version has not changed and we install Java with our executable into it's own folder apart from the usual Java home.
Now instead of looking at all of the children all at once, I need to modify my code to iterate through the list and re-create what worked so well before, or revert back to 4.1 and continue as before.