Friday, April 2, 2010

Automated Testing:Hadnling/Managing ever changing UI - Use of CheckSum

Following post has a bug and an unanswered question - How would you handle dynamically updated web app. I do have some solution in my mind and just need to try it out before throwing as a post. So update soon.... ************

Firstly we need to understand what is Checksum. According to wikipedia:
A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage.

MD5 generated Checksum for a string is unique. And it will always give same checksum value as long as string does not change. Now selenium requests page we can use get_html_source to get back entire html source as a string. Then we can calculate checksums and we store it as our "html data or test data" and proceed with test.

Next time we run test we again get checksum and compare with the (existing) checksum that was recorded earlier.

Now there will be 2 scenarios ==>
1. Checksum is identical to recorded one which means there is no change in UI
2. Checksum do not match indicating change in UI.

If scenario 2) exists, then we can stop testing that particular page and send a report to QA that UI has changed for that particular page!!! At this point individual QA developers can visually inspect changes and verify by running test script meant for that particular page from there own laptops.

This will ensure that any UI change is taken care of. Sometimes we may get false-positive changes, might be due to some text element or images which don't really affect our test scripts because none of form fields or link ids have changed. Hence local execution of the test by QA will be all that is needed to verify if the GUI has really changed to necessitate script changes or its a non-script breaking changes.

Furthermore --- checksum algorithm and parsing html source to traverse through DOM to find elements - update soon...

No comments:

Post a Comment