Using Silverlight 5, Ranorex 6
In our application, there is a form to fill in name of object, etc... once this form has been filled in and the "Ok" button clicked, this item gets added to a tree, where the location depends on the type of object you're creating, child, grandchild etc (see image for better idea - concept shown with arrows). This means the position within the tree could also be different.
Our scope here to be able to create a large(ish) data set quickly using data connectors within the application and prove entry of data works correctly, but my problem is obviously these things aren't added to the tree until runtime. As such I'm having problems validating the data (Name field) that is being added to the tree as it doesn't exist until I run the test. It should be noted if I try image based testing around the text, it works, but obviously this is not robust.
Please note for security purposes I am unable to provide snapshots.
Thank you.
How to validate something has been added to a tree
How to validate something has been added to a tree
You do not have the required permissions to view the files attached to this post.
Re: How to validate something has been added to a tree
Hi Djones,
Unfortunately, I'm not exactly sure if I understand your question correctly.
Could you please explain your approach a little bit more detailed?
Kind regards,
asdf
Unfortunately, I'm not exactly sure if I understand your question correctly.
Could you please explain your approach a little bit more detailed?
Kind regards,
asdf
Re: How to validate something has been added to a tree
Hi,
Additionally, please post a Ranorex snapshot (not screenshot!) of the tree in question. Ideally, post the snapshot created before and after adding new item to the tree.
Additionally, please post a Ranorex snapshot (not screenshot!) of the tree in question. Ideally, post the snapshot created before and after adding new item to the tree.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to validate something has been added to a tree
Hi odklizec
Unfortunately I am not able to produce snapshots due to the nature of my work.
I will try to explain better:
There is a form to input some data, this includes the name of an object. The name of the object is what will be added to the tree and how we access that piece of data from then on. Where the object is placed in the tree will depend on what kind of object you are creating - in this case a parent, child or grandchild, for instance.
Example - in my form I have written "ExampleName" (this could come from a data connector) and some other stuff and clicked OK. This object happens to be a child, so it will be placed (when the tree is open) under a Parent "ParentName" (created already).
I would like to be able to validate what is being added under "Parent", i.e "ExampleName" when technically I do not have an xpath to latch on to as the "ExampleName" object does not exist in the tree until I run my test. The validation part is simple - but what I am struggling to work out is how to dynamically and robustly search "under" the Parent object to find this newly added data. There may be multiple existing children under parent placed on the same "level" as "ExampleName"
Unfortunately I am not able to produce snapshots due to the nature of my work.
I will try to explain better:
There is a form to input some data, this includes the name of an object. The name of the object is what will be added to the tree and how we access that piece of data from then on. Where the object is placed in the tree will depend on what kind of object you are creating - in this case a parent, child or grandchild, for instance.
Example - in my form I have written "ExampleName" (this could come from a data connector) and some other stuff and clicked OK. This object happens to be a child, so it will be placed (when the tree is open) under a Parent "ParentName" (created already).
I would like to be able to validate what is being added under "Parent", i.e "ExampleName" when technically I do not have an xpath to latch on to as the "ExampleName" object does not exist in the tree until I run my test. The validation part is simple - but what I am struggling to work out is how to dynamically and robustly search "under" the Parent object to find this newly added data. There may be multiple existing children under parent placed on the same "level" as "ExampleName"
- ParentName
- AlreadyExistingChild
- Grandchild1
- ExampleName
- AlreadyExistingChild2
Re: How to validate something has been added to a tree
I now have a solution with the assistance of our developers.
This will probably vary depending on your AUT and technology.
What we have done is use a StringBuilder in the usercode.
Recorder actions now work, such as Click repo item ParentNode.
NOTE So far this is only in the init method but could be written so each layer in the tree has its own method, ClickParent() for example, for keyword driven testing and more importantly - simplicity.
This will probably vary depending on your AUT and technology.
What we have done is use a StringBuilder in the usercode.
Code: Select all
//first parent node
StringBuilder sb = new StringBuilder(string.Format("?/?/treeitem[@name~'^.*{0}.*']/text[@name=$varParentName]", varParentName));
repo. ..Tree.ParentNodeInfo.Path = new RxPath(sb.ToString());
//then do the same for each expandable level under the parent. The {0} will increase the lower down you go.
//a Grandchild will need the xpath using {3} args, for example.
NOTE So far this is only in the init method but could be written so each layer in the tree has its own method, ClickParent() for example, for keyword driven testing and more importantly - simplicity.