Forum Discussion

Sys2k's avatar
Sys2k
Occasional Contributor
10 years ago

KeywordTests - Setting Random/Counter Variables

Looking for a simple way through KeywordTests to set a Random or Counter Variable.   So when I'm setting say: 'Username1' the next run through will automatically update itself to 'Username2'.   O...
  • Marsha_R's avatar
    10 years ago

    There is some explanation here about generating data:

    https://support.smartbear.com/viewarticle/71023/

    I would use the above examples to generate your VIN numbers.

     

    For Username1, etc., create a persistent integer variable MyCounter for the counter.

    Increment it with Set Variable Value at the top of your test:  

       Set Variable Value  MyCounter  MyCounter + 1

    Create a persistent string variable MyUserName to hold your user name and set it with a Code Expression inside Set Variable Value:

       Set Variable Value  MyUserName  "Username" + aqConvert.IntToStr(MyCounter)