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

[Solved] Possible to select random values from the Data tab?

1 Answer 37 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Melissa Burpo
Top achievements
Rank 1
Melissa Burpo asked on 11 Aug 2009, 08:57 PM
I am very new to the WebUI Test world, so please excuse me if this is an obvious question or if I have a conceptual misunderstanding of data driven tests.

I'd like to select a random value from the data tab to be inserted during a test.

Specifically, I have a test that enters 5 donations on a gift page, done in 5 steps. Instead of hard-coding which 5 gift values are entered, I would like to randomly select a value from an array for each gift amount, so that the total gift amount is not always the same.

Is it possible to somehow use the Data tab and the Data Driven Editor to accomplish this? For example, is it possible to enter some sort of select statement in the Data Driven Editor to randomly pick a value from a list on the Data tab? Or can I only enter $(columnIndex) or $(columnName) there? I'm starting to think that this can only be done in a coded step, but I wanted to check here first.

Thanks for any help.

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 11 Aug 2009, 10:28 PM
Hello Melissa,

You are correct in that WebUI will only data drive your test in the order that the data is entered into the data column. You would have to convert your data driven test step to code for randimization. 

If you do covert your data bound step to code, you'll see something like an HTML/Rad control is set equal to '((string)(Data["Column Name"]));'

Instead of that value, you can have your data structure in place that is accessed via some random selection algorithm. The test will still run as if data bound, however, in that the entire test and all it's steps will be run for each row in the data column, and you won't be able to change this once the step is converted to code.

If you only want the test to run once, you can unbind that step before converting to code. The code will then be something where an HTML/Rad control is set to your hard coded value. You can then change that value as mentioned above. Hope this helps and please let us know if you have any other questions about this, 

Best wishes,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Melissa Burpo
Top achievements
Rank 1
Answers by
Missing User
Share this question
or