Automated form fills

If you needed to test the forms on a website, you have probably seen how tedious this task can become. Every time the form isn't working properly, you have to go and manually type the same data to test it again. Based on the given input, the form can respond in various different ways. There are many things that can go wrong in a form, so we need to understand the possible cases and test each execution path at least once to validate that the user will see all feedback messages the way we intended. The longer the forms become, the more effort is required to test them manually (even when the browser allows us to select from previously entered data in a given field). A form with ten input fields would require a lot more typing than one with three fields. Field validation should work as expected, while not making the underlying code too hard to understand.

We need to decide what happens when a user is already inside a system and tries to send the same form data, perhaps from another tab. In some cases it may be better to prevent the login, giving a feedback message of the type “This account is currently in use” or we may choose to redirect the user to the last page they have visited, once they try to access the same form again (Ymail, Gmail), or we may let them fill it again and then trigger logout to save/clean the old state and then login again to reuse that state. Depending on our goal, we may choose a different approach.

If we want to test whether our form responds with the correct feedback messages, we could create users with fake data and use it to automatically fill and send the form. Each user would correspond to a single case we expect to see and we need to worry about all these cases only once, not constantly during all our testing. If we tested manually for ten possible responses, it could become quite hard to remember which case we checked last and which one would be next (unless we constantly waste time to mark this on paper).

Selenium also allows for automated tests, but I have found that the effort needed to invest in learning it may not be justified. Having to type and maintain lots of code makes me uncomfortable that the tests themselves may need to be tested. However, Selenium has the additional advantage that it can automatically click on links as well, not just populate forms. Although the tools mentioned above are just for forms, they are free and also keep our cognitive burden as low as possible, which is something I prefer.

bit.ly/1Ihk9Gq