Telerik blogs

*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!


Comments are disabled in preview mode.