TypeText Increments for each Run? Part Deux

Ah, this is similar but different from my other post.

Now I have a script that checks our new user registration path by creating a new user on our site. A test we want to run everyday to make sure the ability to register is working.

Click "SignUpLink"
TypeText "NewUser1"
TypeText "\t"
TypeText "Password"
Typetext "\r"

But, if I run this script everyday as a matter of procedure I would need to change "NewUser1" to "NewUser2" manually so that our website doesn't say, "Hey, that name is in use!"

So, Can I have eggplant add something to "NewUser1" everytime I run the script? Maybe it could get the time off my Mac or something... or the date... that would be useful!

Then add "NewUser04-19-2007-11:30AM"

Deep Thoughts?

Comments

  • Try one of these:
    put "NewUser"& now into userName --now returns the time right now
    //or
    put "NewUser"&today into userName --today's date
    

    I can't remember off the top of my head where date and time are in the reference manuals, but the above should work, unless you want to change the date format.
  • SenseTalkDougSenseTalkDoug admin ForumAdmin admin
    Good ideas. If the test is run once a day, then using the date as part of the user name may be very useful.

    If you prefer a format that will sort chronologically, then you could use:
    set userName to "DailyTest" & the international date
    
    (I'm guessing that the international time would be overkill)

    See chapter 13 of the SenseTalk Reference manual, Working with Dates and Times, for lots more options to play with. :-)
  • This whole program is so increadibly... what is zee word I am seeking in my mellon? Neato? Groovy?

    Thanks again
  • Ok, now I'm really going to reveal my lack of understanding of a basic concept PUT... but I need to figure it out... baby steps... probably

    So if I want PUT to simply type the value I would put this...

    Click "SignUp" -- image of our Link to Sign up, cursor is in the username field
    put "NewUser" & today & now --Types Username in Username field with date&time
    TypeText "\t" -- goes to next field
    TypeText "Password1" --Types Password
    TypeText "\t" -- goes to next field
    TypeText "Password1" -- Confirmes password
    Click "SignUpSubmit" -- Clicks on Submit

    ...or is this

    put "NewUser"& now into userName

    creating a variable named userName and then I have to get it in my field somehow? ie...

    put userName

    I'm missing a screw here...
  • SenseTalkDougSenseTalkDoug admin ForumAdmin admin
    Okay, the put command without an into, before, or after, will simply display a value in the Run window -- it doesn't interact with the SUT. So
    put "NewUser" & today & now
    
    will show you something nice but won't do anything useful. Instead, you want
    TypeText "NewUser" & today & now
    
    which will actually type something on the SUT.

    I'm guessing that as part of your testing later in the script you may need to know the user name that you're using. If so, you'll want to first create the user name and store it into a variable, then use that in your TypeText command, like this:
    put "NewUser" & today & now into userName
    TypeText userName
    
    I hope that helps make it all clear.
  • That is very clear!

    Fine point...

    Can I create this variable anywhere before I call it?

    put "NewUser" & today & now into userName

    or does it need to be somewhere special? I don't know where a special place would be... I'm special. My roomate is special... real special... anyway...

    see what I mean?
  • SenseTalkDougSenseTalkDoug admin ForumAdmin admin
    You'll want to store into it before you use it. ;-)

    Other than that, it doesn't need to be done at any special place in your script. If you want access to it in other called scripts, you may want to use a global variable instead of a local one (which is only available within the current script/handler).
Sign In or Register to comment.