DATA BINDING QUERY....

3 posts, 1 answers
  1. Vaibhav
    Vaibhav avatar
    8 posts
    Member since:
    Nov 2011

    Posted 17 Nov 2011 Link to this post

    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. Answer
    Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 17 Nov 2011 Link to this post

    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
  3. Vaibhav
    Vaibhav avatar
    8 posts
    Member since:
    Nov 2011

    Posted 17 Nov 2011 Link to this post

    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  
Back to Top