January 31, 2011

Smart automated testing scripts

Here is a question to ask yourself. Is your automated test script just a translation of your manual test script? Or does it do something clever?

Let me explain with the help of a very common example.

Say that you are automating the test of the login function of your application. Your application has two textboxes, ID and Password on the login page. You design your auto test script to read the ID and Password from a data file and go about its business (e.g. enter these values in the fields, click Sign On, verify that you get the homepage or the error page etc.).
But, if you think about it, a checkbox for Staying Signed On is quite common on the login pages of web applications. If you do add this, as an optional parameter to your auto test script, you may get two benefits. One, you may be able to use your existing script to test the log in functionality of other applications. Two, if this checkbox is added to the login page of your application, your script requires no change.

Let us continue with this example. Your auto script needs input test data. Say, you provide five sets of this:
a. Valid ID and valid Password
b. Valid ID but no Password
c. No ID but valid Password
d. Invalid ID but valid Password
e. Valid ID but invalid Password

But, if you think about it, just providing a valid ID and its valid Password should be enough for your script to run with each test data combinations. For set b, it does not use the Password. For set c, it does not use the ID. For set d, your auto script may well be able to generate an invalid ID by using a GUID or timestamp and valid Password. Likewise for set e.

Keep going with our example. When testing the login functionality, you are likely to have many pairs of ID and Password data. Several tools provide features to allow iteration of your auto test script with each test data pair (some even allow one to select the pairs sequentially or randomly). If your automated testing tool does not provide this functionality, you may want to have your auto test script iterate through each test data pair.

Think about it. Smarten your automated test scripts :)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.