Forum Discussion

geneticmaterial's avatar
geneticmaterial
Contributor
4 years ago

Data generator question

Hi our QA is writing some keyword tests and has asked for me to help provide a solution to give her a different name per keyword test. Sounds easy enough. At project level, I have generated a list ...
  • geneticmaterial's avatar
    geneticmaterial
    4 years ago

    Figured it out:

    use

    Project.Variables.randomFirst("randomFirst", Math.floor(Math.random() * 1154))

  • AlexKaras's avatar
    AlexKaras
    4 years ago

    Hi,

     

    Excuse me for the late reply...

    You have got correct solution.

    'Random' mode in the Data Generator just means that data will be generated in a random unordered sequence. But the resulting data table is accessed sequentially unless explicitly specified like in your code.

     

    Minor improvement if you don't mind: in order to get rid of hardcoded 1154 value you may use the code like this - 

    KeywordTests.CreateContactVerifyAndLogout.Variables.ListNames("FirstName",
    Math.floor(Math.random() * KeywordTests.CreateContactVerifyAndLogout.Variables.ListNames.RowCount));