Retrieve values from a random row in TDS

  • 8 November 2023
  • 2 replies

Userlevel 3

I have a table in TDS that is populated with multiple test member's data. Each member has a specific value that is 1 of 3 possibilities. Depending on the test I'm running, I want to use the member data for each of the categories but I also want to randomly select one of those specific category rows so each test has a chance to use a different row of data. I've successfully constrained the row selected to the correct category using Data search filter but I've been unable to get a random selection. When I added Random for Position value, I was able to get something different than the 1st available row of that category but it returns the same row every time.

So, let's say that I have 7 rows in the tds table, 3 are category 1, 2 are category 2 and 2 are category 3, I want to select one of the 3 category 1 rows randomly each time the test is run. How do I do that?

Here is what I have for that teststep


[Originally asked and solved on Support Hub]


Best answer by Community Administrator 8 November 2023, 16:21

View original

2 replies

Userlevel 4
Badge +2

If you know the number of rows you can put a random value in the position. For example if the TDS table has 10 rows you could put {RND[1][10]} and it will randomly pick a number from 1-10 at the time of execution.

Userlevel 4
Badge +2

Use {RND} function in the Row position. The only thing you need to make sure of is that you should have those many rows in your result table. Else Tosca throws a no row found error.