Grid Cell Verification

8 posts, 1 answers
  1. Mark
    Mark avatar
    17 posts
    Member since:
    Feb 2013

    Posted 03 May 2013 Link to this post

    I have a question related to verifying cells of data. As nn example I have the following scenario.

    1. Data entry screen to input data, some in text fields and some in dropdown. Data in these fields could change based on user requirements. Data is extracted at the time of entry to have a matcher during verification.
    2. A  data screen with a grid and rows of data.
    3. I want to be able to verify the data in the cells in the grid and compare to data that was entered in the first screen(via extracted data).
    The problem I'm running into is that when I have a row like such:
    <tr class="rgRow Clickable Highlight"  id="ctl01_ctl00_bodyContent_removedForPrivacy_100__0">
            <td>asdfsdf</td>
            <td> </td>
            <td> </td>
            <td> </td>
            <td> </td>
            <td> </td>
        </tr>

    The matching "find element" logic ends up being the data in the cell.
    For example it would have a filter for TextContent that contains asdfsdf and tagname of td.
    Find logic
    Expression = TextContent=^asdfsd,tagname=td
    FindLogic = [tagname 'Exact' td] AND [TextContent 'StartsWith' asdfsdf]
    This would possibly work if the find logic could use the datadriven value, but I don't see any way of doing this.

    This match will only work if that is the data in that cell. If I have a randomly generated string that gets input, this will break the test.
    So I'm wondering if it' is possible to target a specific column given I am looking at a specific row?(row 0(based on the id) col = 0 or something) I've seen some postings where this appears to be able to be done via scripted steps, but that would add a bit of work to the process of creating the tests as I have quite a few areas where I run into this case.


  2. Mark
    Mark avatar
    17 posts
    Member since:
    Feb 2013

    Posted 03 May 2013 Link to this post

    I accidentally posted this in the Test Studio express section, should be in the regular Test studio section. If possible can this be moved over to that section?
  3. Answer
    Rodney
    Admin
    Rodney avatar
    6 posts

    Posted 08 May 2013 Link to this post

    Hi Mark,

    Thank you for contacting Telerik. Based on what you described, it sounds like you will need to 
    Extract the data from the input field and then use the extracted variable in a Data Driven Find Expression to locate the value and verify it. Notice after our 2012 R2 release, this is all possible without code).  The only caveat is that you will have to manually enter the data variable into the “Add coded data variable” field when setting your find expression.

    Please let me know if this helps. If not, will need more information about your test scenario. Please provide a copy of your test and access to your application (or a demo site that uses the same features). 
     

    All the best,
    Rodney
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  4. Mark
    Mark avatar
    17 posts
    Member since:
    Feb 2013

    Posted 08 May 2013 Link to this post

    Thanks for the tip and I'll try it out shortly. 

    I actually was looking at this problem again before I saw your reply and may have also come up with one possible solution, though it does require a coded step to complete and may be a bit tedious in the long run but here is an example scenario and steps I was planning to take.

    Ex: Grid has 2 columns, title and comment.
    1. Start Add data to a grid process.(essentially clicking a button to get to the data input area)
    2. Generate a random value.
    3. Tack on random value to string that will be used for the field being tested(ex: titleCol_1f3c)
    4. Save data to a variable
    ( steps 2,3, and 4  will be part of  the same coded step.)
    5. Enter string_randval data into the field being tested.
    6. repeat steps 3,4,and5 for comments using the random value first generated.
    7. Save data.
    8. Verify data in grid is accurate based on saved variable data and target of field.
    The target(find expression) of the field would be "tagname"-isExactly-"td" and "TextContent"-startsWith-"titleCol"

    Let me know your thoughts on this approach.
    Thanks!
  5. Rodney
    Admin
    Rodney avatar
    6 posts

    Posted 13 May 2013 Link to this post

    Hello Mark,

    Thank you for the update. Although your solution may work, I agree that it may be tedious to work with in the long run. Typically, if something can be done without code, I suggest going that route.

    Since Test Studio allows you to data-drive your find expressions, I would go the UI route unless at some point adding code becomes the more straight-forward solution.

    All the best,
    Rodney
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  6. Mark
    Mark avatar
    17 posts
    Member since:
    Feb 2013

    Posted 11 Jun 2013 Link to this post

    I was able to try this finally, and I have it working. I'm curious though, will the datasource be necessary in the future versions of test studio in order to bind a variable or will there be an option to bind to a variable as an option(if a variable is available)?

    Thanks again for your help.
  7. Rodney
    Admin
    Rodney avatar
    6 posts

    Posted 14 Jun 2013 Link to this post

    Hello Mark,

    I’m happy you were able to get this working. I've filed a feature request for this functionality. You can follow this link to check the status of the request and vote for its inclusion in future releases.  

    Take Care,
    Rodney
    Telerik
    Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
    Reserve your seat today!
  8. Zeeshan
    Zeeshan avatar
    19 posts
    Member since:
    Jun 2013

    Posted 14 Jul 2013 Link to this post

    Woow great coding thanks for sharing with us
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!