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

Compare Extracted Value with Data Driven Value

3 Answers 165 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nigel
Top achievements
Rank 2
Nigel asked on 25 May 2012, 01:02 PM
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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Stoich
Telerik team
answered on 30 May 2012, 05:44 PM
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
0
Nigel
Top achievements
Rank 2
answered on 31 May 2012, 09:19 AM
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.  :)
0
Shashi
Top achievements
Rank 1
answered on 31 May 2012, 12:14 PM

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

Tags
General Discussions
Asked by
Nigel
Top achievements
Rank 2
Answers by
Stoich
Telerik team
Nigel
Top achievements
Rank 2
Shashi
Top achievements
Rank 1
Share this question
or