This is a migrated thread and some comments may be shown as answers.

DATA BINDING QUERY....

2 Answers 121 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vaibhav
Top achievements
Rank 1
Vaibhav asked on 17 Nov 2011, 10:50 PM
I am facing a situation related to data binding. Here are the steps I am following:
1. During my recording I am keying in some value in a search text box.
2. Based on these values some search results are returned by the application (database).
3. I click on one of the search results and follow the rest of the process and stop recording.
4. Now, I data bind my 1st step (the 'search text box' step.).

But when I execute the recording it fails as Test Studio (TS) searches for exactly those words that I clicked on in the 3rd step when I was recording the test case. For example, if my search returned "SYSTEM" during the recording process and I clicked on it, TS looks for "SYSTEM". But if I data bind the search step then the search results are different and TS doesn't find the word "SYSTEM" and the execution results in a failure.

Please suggest something...

Thanks!!!
Kumar  

2 Answers, 1 is accepted

Sort by
0
Accepted
Anthony
Telerik team
answered on 18 Nov 2011, 01:02 AM
Hello Vaibhav,

The issue is with the Find Logic for the Search Result element in step 3. It likely does not have a unique identifier in the DOM, such as ID, and Test Studio crafted its Find Logic based on text content. So when you change the search query, the results are different and Test Studio can no longer find the element with a text content of "System".

There are a few ways to approach this. Ideally the search result element you intend to click has an ID, or some other static attribute, so that Test Studio can reliably find the element between iterations, no matter its text content.

However I suspect that it does not. In that case, you can data drive the find expression for the search result element to use the same data column that is bound to the search query step. This currently cannot be done through the UI. Here's how to do that in a coded step. Here is some code I adapted specifically to a search query and result scenario:

HtmlAnchor link = Find.ByContent<HtmlAnchor>(Data["Col1"].ToString());
Assert.IsNotNull(link);
link.Click();
 
Be aware that if the search query data is not specific enough, the code above may locate and click a different link with matching content.Greetings,
Anthony
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vaibhav
Top achievements
Rank 1
answered on 18 Nov 2011, 01:22 AM
Thanks Anthony for the prompt response to my query. I am going to try this first thing tomorrow and see if it works.

Thanks Again,
Kumar  
Tags
General Discussions
Asked by
Vaibhav
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Vaibhav
Top achievements
Rank 1
Share this question
or