Compare Extracted Value with Data Driven Value

4 posts, 1 answers
  1. Nigel
    Nigel avatar
    53 posts
    Member since:
    Jan 2012

    Posted 25 May 2012 Link to this post

    Hi,

    Is it possible to compare a data driven value with an extracted value without going into the code behind window?

    For Instance, I have a data driven test that wants to check the value of a particular field and then write to the field depending on what value is already present.  The method would be to extract the current value into an extracted variable $(MyExtractedValue), then compare it with the value that is held in the data $(MyDataValue).  So far I have not found a way to do this without going into VB.

    Thanks,
    Nigel Edwards, Transition Computing.
  2. Answer
    Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 30 May 2012 Link to this post

    Hello Nigel,
    you can use a workaround to achieve this, but it's not very graceful.

    Let's image you have a text input filed (a control you can write into).

    You can have step:
    1) Type $(someText) into control where someText is a variable that stores an extracted value
    2) Verify input 'SomeInput' value 'Exact' '$(textFromData). where textFromData is the name of a column from your data source.

    Basically, first you type in the extracted value into a field. Then you use a Verification to verify the text against a value from your datasource.

    Regards,
    Stoich
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Nigel
    Nigel avatar
    53 posts
    Member since:
    Jan 2012

    Posted 31 May 2012 Link to this post

    Thanks Stoich.  You're right, it isn't terribly graceful, but it is a solution that I might be able to utilise, so thanks for that.  Perhaps Telerik could add a facility to do this to a future release?  Either way, thanks.  :)
  4. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 31 May 2012 Link to this post

    Stoich:

     

    According to Nigel's post, the test needs to "check the value of a particular field and then write to the field depending on what value is already present".  So it seems to me the code would be (using Nigel's variable names):

    IF(Verify input 'SomeInput' value 'Exact' '$(MyDataValue)' )
       .Type $(someText) into control
    ELSE
        Comment:  Do nothing
       // this statement is here for clarity - it is optional in the real code.

    Nigel:  
    The above is ideal if what you want to write to the field is the same regardless of $(MyDataValue) - or the value that you type in can be computed using purely recorded steps (the steps to compute/extract the typed in value can be inside the if statement or come before it depending on your requirements).  If that is not the case, then I think you would be better off implementing the step as a coded step in VB.  Is there a reason you are reluctant to go to code-behind?
     
    Hope that helps,
    Shashi

Back to Top