April 4, 2013 by Roman Ožana

How to Automate Your Login Form Tests Using Testomato

Last week, we discussed how to write a test case and manually test a login form. In today’s post, we’ll go over how to automate test cases for a login form using Testomato.

Important noteThis post was updated in May 2015. 

A little more about test cases…

As we mentioned last week, it’s important to come up with various combinations of user scenarios, in order to catch mistakes more easily.

It’s also important to consider both positive and negative test cases. All this means is that you create cases that are designed to return both the expected results, as well as results that are outside of what the requirements of a product have defined.

Here are some examples of positive and negative test cases for a login form:

Positive test cases

  • Valid Username and Password takes you to the correct page
  • Click Forgotten Password hyperlink and go to the recovery page

Negative test cases

  • Submit Username only and click Login
  • Submit Password only and click Login
  • Submit an invalid Username and a correct Password
  • Submit correct Username and incorrect Password

The scenarios we have just mentioned above can be manually tested, or you can also choose to automate the process.

So, how can Testomato help automate a login form test?

Testomato lets you create tests that are able to check whether the forms on your website are functioning correctly. We try and detect all HTML <form> </form> tags and create a test for each form that we are able to locate. These tests show up as a gray box in your basic test suite until they have been fully configured.

Once you’ve added the params you would like to be checked, we’ll send POST commands to your form (i.e. we test the form as if we’re one of your visitors filling in the form and pressing Submit).

Here’s how to do it:

1) Create your project! (We’ve used the same example e-shop website from last week to set up our example test suite.)

2) Any forms that are found will be displayed as gray boxes at the bottom of the test suite. If you’d like to add a form we might have missed, just click: Add test and enter the URL of the page where the form is located.

form-test-1

3) Select an unconfigured form and click on the edit button in the right hand corner.

4) Fill in your parameters based on your test case. For this example, we’ll use the following positive test case: Valid Username and Password takes you to the correct page. 

5) Configure your form by entering the data you wish to send to your form:

  • Email: info@testomato.com
  • Password: 1234
form-test-2

6) Fill in the expectations and results for your test case:

  • Select the box next to My Rules and click Add rule. 
  • Configure your test to search that the HTML on Page contains <h1>My Account</h1>. (i.e. We expect that the correct login information will redirect us to our account page.)form-test-3

7) Click save. Your forms will now be tested each time your test suite is run!

What else can I do?

Configure and automate more test cases for your login form! Here are a few more configurations to test more of the scenarios mentioned at the beginning of the post:

Submit Username only and click Login 

– Email: info@testomato.com
– Password: <empty>
– Check whether Text on Page contains the following:

  • Warning: No match for for Email Address and/or Password.

Submit Password only and click Login 

– Email: <empty>
– Password:1234
– Check whether Text on Page contains the following:

  • Warning: No match for for Email Address and/or Password.

Check if Reset Password link is working 

This is the only test that is NOT performed as a form submission. Instead, you’ll need to add a test for the Forgot Password link on your website. Once your test is set up, you can configure the following Rule to test that your recovery page is working.

– Check whether Text on the Page:

We hope this post will help you to learn how to automate certain aspects of your testing process using Testomato and save yourself some time (and a few headaches)!

Any suggestions about how we can improve form testing? 

Leave us a comment here or on Facebook. Or, tweet us directly @testomatocom.

Thanks for reading! We look forward to hearing your feedback.

Is your website available? Testomato can check your website availability every 15 seconds from 10 different locations around the world and will send you an alert if the site is unavailable.

Keep track of the important parts of your website with simple checks that can run every minute. They can check plain words, HTML code, HTTP headers, redirects … and much more. Never miss anything.

Websites break, it happens all time. You'll be the first to know. Testomato has an extensive database of and will let you know if it finds any error on monitored url.