Thursday, January 30, 2014

Can’t Identify an Object on Run Time?

During Test Automation, we identify various objects successfully, but many a times during script execution we face issues where our scripts fail to identify objects. What is the probable cause of such errors? Well, I'd say the test environment plays an important role in which you run your scripts.

Load relevant Add-ins

Make sure you have loaded ALL the relevant add-ins required for your Application under Test (AUT).

Disable Protected Mode

In IE, clear the Enable Protected Mode option under Tools > Internet Options > Security

User Account Control (UAC)

UAC was introduced in Windows Vista and continued in Win 7 and Win 8/8.1. UAC can interfere with your application. It is a good idea to disable it while working with any Test Automation tool.
To turn-off UAC in Windows 7, go to Start Menu > Search for “Change User Account Settings” > Disable UAC
To turn-off UAC in Windows 8/8.1, you need to take help of registry. UI setting doesn’t trulyturns-off UAC in Win 8/8.1. Hit Win + R key, type regedit and click OK. Navigate toHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System
Find the key: EbableLUA and change the Value Data value to 0

Zoom Level

Make sure the zoom level is set to 100% while testing in any browser. Check the illustration below on how zoom-level affects highlight object functionality in QTP. (Focus on the blinking black rectangle on the left once the Highlight button is clicked on the right.)


A shortcut key to get back to 100% zoom is Ctrl + 0 (that’s zero).

.Object Notation

There are times when identification properties are not enough to identify an object. You may make use of native properties in that case. Use .object notation to locate the erring property. Make sure to correctly identify it.

Low level recording

After you have exhausted all options you can try Low level recording. It’s not a good method from maintenance point of view but it may come handy at times.

My tool has worked for ages identifying objects correctly, stopped working since yesterday

If something like that has happened probably there is some change in your browser or UFT software itself. Try to disable auto-updates on machines where tool is installed.

Type property for WebButton class

If you’re testing cross browser, don’t use Type property to identify Webbutton class since the default value is different for IE (button) and Firefox (Submit).

Object with dynamic properties

If automation test tool was successfully able to identify object at record time but unable to identify the same object during replay time, there are chances that object properties are dynamic in nature. Make use of regular expression or parameterization to handle those dynamic values.

Version of Browser and Windows OS

Make sure the version of tool you use supports the version of your browser and/or your Windows operating system. Check the complete UFT vs. browser support matrix and UFT vs. Windows support matrix.

Install relevant patch

In case your application version is not supported by the version of tool, keep an eye on various patches that tool vendor comes up with from time to time. For example,

Forums

If nothing works for you, you can ask your question at various forums dedicated to the usage of tools. Please make sure your question is detailed enough to solicit good responses.

Wednesday, January 29, 2014

Testing XPath in Google Chrome browser

Many times during Test Automation, we use XPath to match the required object/tag in the DOM. While working with XPath, I'm wondering is there anyway to test XPath in Google Chrome browser with highlighting the matched tag in browser. The answer is YES. We can test XPath in Google Chrome.

Follow these steps to test your xpath:

1. Open Developer Tools - When you're in Chrome (on the page where the object is appearing), press F12

2. Select Console tab - just press ESC key and you'll see extra pane appearing at bottom. This is where you can type commands to test XPath.

3. Use $x token. For example, enter following in the console windows $x("/html/body") and then press ENTER. It will select the body tag and the result tag will appear just below command you entered.

In case, the entered XPath is wrong, it won't return anything.

Bingo!


NOTE: Unlike Firefox, Chrome has an in-built "developer-tools" option!

Monday, January 20, 2014

Defect Density!

Defect Density is the number of confirmed defects detected in software/component during a defined period of development/operation divided by the size of the software/component.

The ‘defects’ are:
  • confirmed and agreed upon (not just reported).
  • Dropped defects are not counted.

The period might be for one of the following:
  • for a duration (say, the first month, the quarter, or the year).
  • for each phase of the software life cycle.
  • for the whole of the software life cycle.

The size is measured in one of the following:
  • Function Points (FP)
  • Source Lines of Code

DEFECT DENSITY FORMULA
defect density image





USES

For comparing the relative number of defects in various software components so that high-risk components can be identified and resources focused towards them.

For comparing software/products so that quality of each software/product can be quantified and resources focused towards those with low quality.