Entries from May 2008 ↓

Testing using standard perl scripts - 1

Been a looong time since i sat down to blog, (assumption being that you need to go out and learn something new to blog something new). After another burst of heavy testing, i gathered a few essentials of writing good for automated testing. Here are a few observations. I hope to continue this serious……

1. Logging is everything - This is one obvious thing that most automation framework developers dont concentrate much on. As a QA person the application dump is the first place we go to track/analyze a defect. Similarly when an automation perl script is developed a standardized log record of the various tests and outcomes is very helpful. A good format for (found in most standardized logs would look something like this:)

<timestamp> <Tag>: <Descriptor>

The Tag should be a finite list of callouts like: Fail, Pass, Info, Checkpoint etc.

This is purely for the puropose of running overall searches when you log files become huge. For example, after every run of the script, the tester would be interested in Fails (obviously). This is where these tags
come handy. A simple search for “Fail” would tell me where all the test has failed.

2. Non-interactive automation scripts: These are cases where the user inputs (if any) are recorded into .conf (config files). This helps “silent runs” of the test scripts. Designing good config files are very important. Be sure to provide flexibility of ignoring comments and blank while parsing config files for parameters. See a sample perl code snippet below

s/#.*//; # ignore comments by erasing them
next if /^(\s)*$/; # skip blank line
chomp;
push @test_cases, $_; # push the data line onto the array

Another possibility would be to ignore comments at the end of a line also like:

[test_case_login]

username=mike #place where the username goes in

password=gogogo #place where the password goes in

From a readability perspective, provide users of your automation framework to have such comments in their config files, (make sure you handle these types of comments also). Checkback with me if you need a code snippet for that (Exercise for the reader :-)

If you enjoyed this post, make sure you subscribe to my RSS feed!

Related posts