TA Basics: Do we script a click or a tab?

On most websites and applications you might need to fill in a form of some kind. Some people like to `click` in each field with the mouse, others like to use the `tab` button on the keyboard. But do you need to script both of these scenario's for your automated tests?

https://www.service-hub.com/ contact form

What to test and why?

There are a bunch of additional questions that pop-up in my mind when I ask myself the question: "`Click` or `Tab`, which will be required in our test automation suite?". Because sure, we can automate both scenario's, but why is this needed? Would it be sufficient to automate only one of these? Can we mix them (most fields click and only one tab)? Will automating it save us time/effort? 

The answer is simple: "It depends on what you want to test and what the test should be covering". 

If you want users to navigate through the website with keyboard tabs, you should test this.
If you want users to navigate through the website with mouse clicks, you should test this.
If you want users to be able to use the functionality (with valid/invalid/missing information), you should test this.

Test manual or automated?

Notice I said "you should test this" instead of "you should automate this". When you want to make sure it works, you should test it. But you don't need to automate scenario's unless it makes sense to do so. Usually test automation is testing functionality. And pressing a tab to go to the next input field is usually something visual. Therefore I always ask myself the questions:  "Will it save time/effort when I automate this?" and "Is the task complicated to perform manually?".

As a tester you should not only automate tests because someone wants it automated, but you should also think why you automate tests and discuss if it does not have any benefits in time/effort/money.

Scenario example

Usually pressing a tab means going to the next field and that is more visual than functional. With most test automation scripts, you test if the fields and forms behave as they should. This also means that your script will do something like, just filling in the form and submit it:
Form.first_name_input.send_keys("firstname") Form.last_name_input.send_keys("lastname") ... Form.sign_me_up_button.click

And in most cases this will be enough, and testing if the tabs work correctly you can leave for the UAT phase or leave as a manual task you go over when doing some visual checks. But there might be cases where you do want to add it to your script. For example we noticed that on the service-hub application we have a form to edit materials, and this form contained a field in which a price was shown. While clicking and typing the values all went as expected. But the moment we started to use the keyboard tab button after entering the price, two 0's got added in that field. Obviously this was a bug (should only add them when only round numbers where used) and this is fixed now, but here it's shown that the behavior is different when you click versus tab because of some added functionality/behavior to this particular field. So in our case it made sense to add this to the test suite because we want to cover all functionality with test automation.

Don't forget

Last but not least, if you don't add it to your test automation framework, at least make sure it's written down, so when manual tests are performed you've cover it. Because testing if it works, is knowing if it works, manual and automated. And test automation is not a replacement of manual testing. It's always a good idea to have some kind of manual testing before going live as well.

Comments

Popular posts from this blog

PowerShell - How to overcome Azure VM's fixed resolution limitation

TA Basics: Website Test Automation on mobile devices via Appium server

TA: Who doesn't like proxies? Me!