November 20, 2014 by Roman Ožana

How to Use Random Values to Test Your Forms

We recently talked about different ways to test signup forms using Testomato. At the time, we didn’t support random values in our form tests. This meant that users needed to run an extra script in order to create a new user each time a form was tested.

A lot of you asked us about random form values, so we added this feature to make testing forms even easier!

With this new update in mind, we’ve pulled together a quick tutorial to show you how to use random form values.

Let’s get started!

Here’s how we set up our dashboard:

  1. Login to your Testomato account.
  2. Enter the URL: http://www.testomato.com/ at the bottom of your main dashboard.
  3. Click Create new project.

Once you’re project is created, your dashboard should look something like this:

Testomato dashboard

How to Register a Random User

Once your dashboard is ready, you’ll need to create a signup form test. We created a sample signup form for our own site that will return a simple green alert when data is sent successfully.

signup form example

Our real signup form follows a unique email validation rule, which can cause problems with automated testing. This means that normally when you use the same email address in a test and repeat it more than once, you get a duplicate email error asking you to provide a different address.

It’s easy to solve this problem using random values. A lot of servers (including Gmail) also have a feature that often gets overlooked, which allows you to add a postfix with a plus (+) after a main address. In other words, elle+value@testomato.com will send emails to elle@testomato.com.

You can generate email postfixes using random form values by entering an email like the following in your form data: elle+%5TestomatoRnd@testomato.com. Testomato then automatically adds a 5-character random string after the main address.

This helps in two ways:

  • You can finish your registration process without receiving an error.
  • You’ll be able to easily separate your testing account from real user accounts.

Here’s how to do it:

  1. Click +Add form test from your project dashboard and enter the following URL: http://www.testomato.com/example/signup/
    new form test
  2. Select the form you’d like to configure.select form
  3. Enter your credentials:
    login: testmail+%5TestomatoRnd@gmail.com
    password: mypasswordenter credentials
  4. Check the box next to check for string occurrence and type “New user Elle created”.Type string
  5. Click Create.

How to Test a Random Login in Testomato

  1. Click configure form values for the test you’d like to configure.
  2. Enter the following data you’d like sent to your form and click Save.
    login: user%5TestomatoRnd
    password: mypassword
  3. Select the box next to check for string occurrence.
  4. Enter the expected message you’d like to see. For example, we used the message: “User not found”.
  5. Click Save.

Have more questions for the team?

Let us know in the comments below or on Facebook. You can also tweet us directly @testomatocom. We’re happy to help!

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.