Forum Discussion

veronica_glynn's avatar
veronica_glynn
Contributor
11 years ago

Generating random string values (A - D) & select from dropdown

Hi! I am automating our Student Testing module and need to generate random test data to pass into the question answer fields. The expected values range from A to D and are selected via a drop down. I tried the Data Generator that is provided w/ Test Complete but could not figure out how to limit the data to what I need.



Any help would be greatly appreciated. Been banging my head on this for 1/2 day now. :-)



  • function randomAnswer(){


      var answer = ["A", "B", "C", "D"];


      return answer[RandomInt(0,3)];




     


     


     


    function RandomInt(min, max){


      return Math.floor(Math.random() * (max - min + 1)) + min;



  • murugans1011's avatar
    murugans1011
    Regular Contributor
    In the Data generator click the 'Value from a set and add the required values in 'Custom Values' then click 'generate'