Test Studio 101: How To Record A Login Test

Wednesday, September 26, 2012 by Stoil Stoichev | Comments 3

*this article talks about HTML-based apps; Silverlight is a different story

For today's lesson we're going to talk about the most basic of scenarios: automating your Login screen. Sure this might seem simple. But lately I've noticed that some new Test Studio users struggle with this.

The question you might be asking yourself is:

"I thought Test Studio is supposed to be the most intuitive UI automation tool on the market? How can recording a simple Login sequence be so complex that it requires its own blog post?"

OK, that's actually two questions. Anyway, the thing is that when you're putting this together you need to take it slow. And not press "Tab".

Let's break it down. A typical Login screen would have a username field, a password field and a Login button:

When you use this control day-to-day you want to go through it as fast as possible. So you would type really fast.You would use "Tab" to shift focus between the username/password/Login button. And you would hit the "Enter" key to click on the Login button. However, this approach transfers very poorly to a Test Studio test. What usually happens is the test will end up typing the username into the password field. In order to avoid this simply remember that:

Test Studio will always set focus to an element before attempting to manipulate it.

A step that types into the username filed like this:

would first set the focus on the username field and then type into it. And this is why Test Studio does NOT record clicks into input fields - they are unnecessary. In the same way "Tab" click are also unnecessary.

So here's what you need to do in order to successfully record a Login sequence (remember to take it slowly):

  1. Navigate to Login screen - this generates a NavigateTo Step
  2. Click User name field      - this does NOT generate a step
  3. Type user name               - this generates an EnterText step into UserNameField (actual name will vary)
  4. Wait for it to record         - you need to see that the EnterText step has been generated
  5. Click password field        - this does NOT generate a step
  6. Type password                - this generates an EnterText step into PasswordField (actual name will vary)
  7. Wait for it to record         - you need to see that the EnterText step has been generated
  8. Click Logon                     - this will generate a Click step on the LoginButton (actual name will vary)

The end result will look something like this:

 

And there you have it.

About the author

Stoil Stoichev

Stoil Stoychev

has been helping customers solve their complex testing challenges leveraging his in-depth knowledge of Telerik Test Studio. He has traveled the globe fine-tuning his technical expertise and helping our valued clients succeed. In his spare time he enjoys motorcycles, live music and various sports.

Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!

3  comments

  • Lydia Smith 27 Sep 2012
    Thank you for the nice breakdown on this!
  • Ines 17 Feb 2013
    Hi, thanks for this example it was really clear. 
    I have a little problem : I recorded a test including such step: clicking on button that generates a popUp window. When i executed it, the test terminated as passed but the popUp did not appear. I inserted wait step but it's was not the best solution.
    So can you help me and thanks a lot.
  • Hey! I know this is kind of off topic but I was wondering if you knew where I could locate a captcha plugin for my comment form? I'm using the same blog platform as yours and I'm having problems finding one? Thanks a lot!

Add comment

  1. Formatting options
       
      
     
     
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)