Automate the tedious checks

In order to run a test you may need to navigate through to a certain series of web pages or have some data pre-populated in the database.

At times like this it can be useful to use automation or SQL scripts to reduce the manual labour involved in getting ready to test.

When I was testing a multi-user permissions system I needed to log in, change permissions for the user, log out and then log in again to check that the permissions were applied. Doing this manually was tedious so I wrote a basic Selenium UI automation script that did the logging in and out. This sped up my testing and took away the clicking from me. It wasn't used to automate any of the actual testing, but it did help to automate my journey to get to the test point.

When I'm testing anything that requires data already loaded I also use SQL scripts to populate the data or a "Golden" database to restore to.

I once did some consultancy with a large financial company and was amazed that their test team spent an entire week populating the test database before they could even start testing. They did this every month after a new release of their code to the test environment. Every month they lost 1 week of the whole test team as they populated the database. A "Golden" database solution worked a treat and saved them thousands of pounds in wasted time. That restore of the data took just 15 minutes giving the team an entire week back for doing more valuable testing.

A general rule of thumb is that if you find yourself repeating the same steps more than a handful of times then you may want to consider automation or data population.

How?

To create a simple Selenium script you will need to install Selenium first, read the instructions on how to get going and learn how to use the tool. It's really simple to use. It even includes a record and playback feature which is pretty useful for most websites. For more advanced sites with authentication and lots of JavaScript you may need to hack around with the script further.

A word of caution though. Using Selenium as a record and playback mechanism is not a good substitute for proper unit, integration and UI tests that have been coded well, stored in source control and are run on every build/release/check-in. But Selenium can be useful to quickly knock together a script to aid your testing.

I won't go in to the deep instruction of Selenium here - the Selenium website has all you need to get going.

Learning SQL is also pretty straight forward, especially for basic queries and data manipulation. More complex databases and queries can become quite tricky to create and take time and practice. But to get started I would recommend you head to W3 Schools and work through their SQL tutorials - they are really useful.

Useful Hint

Download an SQL tool like SQLYog, connect to your DB and get cracking with writing SQL. Be careful though if you are using your production database - it is very easy to make a mistake and damage the data. Make sure you are connected to the right database and you're in control of what you are doing. I've seen many people destroy production data simply by being connected to the wrong database.

Useful Links

SQLYog Tool - http://www.webyog.com/en/downloads.php

SQL Learning at W3 Schools - http://www.w3schools.com/sql/default.asp

Selenium Debugging - http://seleniumhq.org/docs/02_selenium_ide.html#debugging

Selenium - http://seleniumhq.org/



If you’re interested in a career in Software Testing then check out my book Remaining Relevant And Employable (Tester’s Edition) - it’s packed full of ideas about writing good CVs, communicating your value to employers and doing well in an interview.