Data Driven Validation

7 posts, 1 answers
  1. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 18 Oct 2013 Link to this post

    ok I created a Verify test when I initial recorded my test to verify this text 'Welcome to eZone, Nick'
    but now I want my test to be data driven so I bound the verify test to my value for FirstName and the compare
    type is set to contains and my expected value is still set to original recorded value.

    but my test just seems to fail how to I get my test to verify that my text is  'Welcome to eZone, {FirstName value here}'
  2. Answer
    Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 18 Oct 2013 Link to this post

    Without seeing the failure message from the log, it will be a bit harder to diagnose what the exact issue is.

    I just did a quick test against the telerik site (the "Hi, Your name" in the top span).

    The only way I could see doing this, unless your data driving text is "Welcome to eZone, Nick" would be to convert the step do code and do the following:

    I made a local data name with a single column called "Name" and put "Daniel Clark" in the first row.
    // Verify 'InnerText' 'Contains' 'Hi, Daniel Clark' on 'HiSpan' - DataDriven: [$(Name)]
    Pages.TelerikNETUIControls.HiSpan.AssertContent()
        .InnerText(ArtOfTest.Common.StringCompareType.Contains,
         (String.Format(
    "Hi, {0}", (string)(System.Convert.ChangeType(Data["Name"], typeof(string))))));



    In your case, it would be more of
    String.Format("Welcome to eZone, {0}", (string)(System.Convert.ChangeType(Data["DataDrivenName"], typeof(string))))

    Worth a shot.
  3. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 21 Oct 2013 Link to this post

    thanks, it would be nice if you could do this right in the UI, like you can do with their controls
  4. Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 21 Oct 2013 Link to this post

    I agree.  If there is a way currently, I am not aware of it and would love for Telerik support to let us know!
  5. Rodney
    Admin
    Rodney avatar
    6 posts

    Posted 23 Oct 2013 Link to this post

    Hi Andrew,

    Test Studio supports data driving verification through the UI. Try changing the CompareType to 'Exact' rather than 'Contains'. Does the verification pass? If not, make sure you're following the steps in the support document Attach Columns to Verifications

    If you're still having issues after changing the CompareType and following the steps in the article, I'll need more information to diagnose your issue. Attach a copy of a demo test that displays the behavior. I'll download it and determine why the verification is failing. 

    Regards,
    Rodney
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  6. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 24 Oct 2013 Link to this post

    but doing an exact match will not work because I build the value I want to validate is a combination of static and data driven values.
    That's why support for string builder would be nice.
  7. Rodney
    Admin
    Rodney avatar
    6 posts

    Posted 29 Oct 2013 Link to this post

    Hi Andrew,

    Thanks for the input. I've created a Feature Request to add support for string builder without code. You can comment on the feature and vote for its popularity here

    Also, be sure to check out our Extract Variable feature for extracting values from existing elements. This can be extremely helpful if you need to reuse extracted values later in your tests.

    Regards,
    Rodney
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!