Completed
Last Updated: 08 Apr 2019 12:17 by ADMIN
ADMIN
Velin Koychev
Created on: 13 Aug 2013 07:44
Type: Feature Request
2
Test Studio elements find logic to support relative xpath
Customer has a problem with an Element in his test; when he customises the xpath it continues to work, but when he also adds a data-driven identifier, the xpath locator becomes corrupted which has two major impacts:
1: The test run fails, because an Invalid expression exception is thrown when the test tries to find the element.
2: The Edit Element window fails to open, because an exception is thrown in BuildFindExpression.

Steps to reproduce:
1: The overall plan is to define a data-driven element, which can match any of the links in a table column (see attached screenshot 1).
2: At first, use the element recorder to record a Verify Exists step with the default locator (screenshot 2).
3: Edit the element, adding an xpath locator (screenshot 3); note that this xpath does not identify a single link, but identifies all the links in the table.
4: With the edited element, run the test again; it passes. This confirms that, at this stage, the xpath is not causing any problems.
5: Edit the element a second time, this time replacing the hard-coded TextContent with a data-driven field (screenshot 4). The xpath is unchanged.
6: Run the test; this time it fails. But it doesn't fail to find the element, in the normal way; instead it throws an exception when it tries to apply the find logic (attachment 5 has the full results log with the exception callstack), based on only part of the xpath:
Exception thrown while finding elements for the following descriptor 'Verify Exists 'UnassignedTable_SubmissionIDLink_datadriven''. Exception 'System.ArgumentException: Invalid expression ' 'rowUnAlloc')]/td[2]/a'
7: Try to edit the element again; the edit window does not open, instead test studio shows a dialog with another exception (screenshot 6):
at
ArtOfTest.Common.Design.ProjectModel.Elements.FindExpressionElement.BuildFindExpression(String fes)
at
ArtOfTest.Common.Design.ProjectModel.Elements.FindExpressionElement.get_DataBoundFindExpressions()
at
ArtOfTest.WebAii.Design.UI.FindElementModel.BuildSentencesFromCurrentExpression()
at
ArtOfTest.WebAii.Design.UI.FindElementModel.set_IsDataDriven(Boolean value)

When it gets to this state, the test step and the element are unusable; the only way to proceed is to delete the step, delete the element, and start again from scratch.

Variations

This fault does not always manifest itself in the same way. Sometimes the term 'xpath' goes missing from the identifier, also resulting in a find failure at runtime, but not preventing the element editor window from opening (screenshot 7).
Sometimes the fault emerges after the first time I edit the element; sometimes only after subsequent edits, as described above.
Sometimes, the introduction of the xpath identifier causes runtime identification failures, even though the overall identifier does not seem to be corrupted and the xpath should be successful.

The screenshots and the sample test are attached in the internal description. 
2 comments
ADMIN
ipanchev
Posted on: 27 Sep 2013 07:19
Turning this into a feature request.
ADMIN
ipanchev
Posted on: 24 Sep 2013 12:59
For now we cannot validate against relative xpath, this is a known webaii framework limitation.