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:
- Login to your Testomato account.
- Enter the URL: http://www.testomato.com/ at the bottom of your main dashboard.
- Click Create new project.
Once you’re project is created, your dashboard should look something like this:
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.
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, firstname.lastname@example.org will send emails to email@example.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:
- Click +Add form test from your project dashboard and enter the following URL: http://www.testomato.com/example/signup/
- Select the form you’d like to configure.
- Enter your credentials:
- Check the box next to check for string occurrence and type “New user Elle created”.
- Click Create.
How to Test a Random Login in Testomato
- Click configure form values for the test you’d like to configure.
- Enter the following data you’d like sent to your form and click Save.
- Select the box next to check for string occurrence.
- Enter the expected message you’d like to see. For example, we used the message: “User not found”.
- Click Save.
Have more questions for the team?