We have a function that introduces randomness in item ordering, e.g.:
- the order in which a number of given items are presented to a user is random
For this scenario, there needs to be automated test, I am thinking:
- Compare the configured item order against the actual presented item order, if they are different, the test will pass.
But there is always a chance that the randomised order happens to be identical with the configured order, e.g.:
- We have configured 5 items to be presented to a user, the chance for them to be presented exactly the same order as they are configured is
1 in 5*4*3*2*1; for 10 items, the chance is
1 in 10*9*8*7*6*5*4*3*2*1; there is always a tiny chance this automated test will fail.
Is there any certain way to test against randomness?