Forum Discussion
Thanks for sharing such great information, Dan!
Great opportunity!
For python you can use this expression:
import random
var = random.choice([i for i in range(x)]) # Will return the random mumber between 0 and x
- vondie9 years agoContributor
baxatob,I tried to implement your suggested Python code into a Keyword Test and I can't get it to work. Is it possible to import a library into a Keyword Test? I tried using the Run Code Snippet tool to add "import random" at the top of the script but I am getting exception errors. See screenshots for examples, if desired. I can create a script but my team has decided that the majority of our tests should be Keyword Tests, not Scripts, so they are easily debugged by everyone on the team. Thanks!
- baxatob9 years agoCommunity HeroHi Vondie,
You can create the script and then call it from your keyword test using Run Script Routine item.- mgroen29 years agoSuper Contributor
SmartBearDan Great solution! This is exactly what I am looking for.
Note: Could be even better if this feature (select random row) be implemented in TC's Data Driven functionality, so that testers don't need to use scripting!
See screenshot to illustrate implementation:
I created a feature request. It can be found here. Please vote for it if you agree.
Related Content
- 3 years ago
Recent Discussions
- 24 minutes ago