Automation Test for CRM_UI using HP QTP – Must Know
HP QuickTestPro is undoubtedly the most powerful functional testing tool upon creating and performing automation test. Compared with SAP eCATT, it has obvious advantages as eCATT has limited capability of testing complicated web based applications (though it does have support for Webdynpro,etc), and moreover, QTP-SAP add-in provides almost the same compatibility for SAPGUI applications as eCATT. You can also integrate QTP with eCATT script to enhance your testing framework for your product.
However, when using QTP to create automation test script for CRM WEB UI, you would probably encounter bunch of issues due to CRM_UI tech itself.
First and Foremost, on rendering CRM_UI technology generates extremely complicated HTML. The fact that up to around 50% attributes of html tags are dynamically created and loaded with multi layer iframe made it impossible for QTP to locate some elements by default TO attributes (value of RO attributes keeps varying).
Thus, we should avoid fully relying on simply recording and playing back. That won’t work for most cases as QTP will prompt runtime error that paticular objects cannot be recognized.
In this case, you have to dive into HTML code to see if the very object has some constant attributes. If not, use regular expression to define the object.
Simultaneously, shortcut “F2” is a inbuilt function that would be helpful for you to find out the technical attributes of different CRM_UI components, and whereby you can write corresponding regular expression rule.
Secondly, there is a shift between elements’ actual location in the browser and the location attributes (x_axis,y_axis, etc) of QTP objects. You’ll see that the moment you try to web spy something on CRM_UI webpage.
And visual identifier cannot work as well because the location of referencing object will be inaccurate for most cases.
Still more, QTP’s ability to detect and dive into web page objects vary from environments, mainly related to browsers and installed QTP patches. While other any patch would bring issues, please adhere firmly to the following three necessary patches unless any patch was proven to be useful for CRM WEB UI testing: QTP_00699 QTP_00086 QTP_00709
Webpage created by CRMWEBUI is a collection of pages(iframes) on different layers and have respective inheritance relationships, and several QTP patches/browser version (especially IE) will affect the way QTP recoginze CRM web elements. It becomes more apparent for PPF action / SAPNavigationBar.
Often QTP cannot recognize the button in SAPNavigationBar by itself as it’s not on the mainframe and it’s a special object that QTP cannot penetrate. When recording, QTP will perceive that user did a click on a box/container element, but actually a click event on its affiliated link element (<a> tag) was triggered.
For IE8+/other modern browsers, you may use the following function to do a click:
And call this function like this: Call FindCRMLinkByText(“ABC”,”Home”) This function will receive page name and the innertext of <a> tag, search all elements in all iframes to find out the corresponding element.
For IE8/IE8-, use following function instead:
‘ Generally when seq=1, it’s “Home” button
Set node1= Browser(“Browser”).Page(“index:=1”).SAPFrame(“index:=1”).SAPNavigationBar(“index:=1”).Object.getelementsByTagName(“a”)
This function uses Object method, thus it only works on IE. It will click the 6th button in SAPNavigationBar object no matter if you can recognize the elements of it in QTP or not, the browser can. It’s using native DOM objects rather than QTP objects.
As for PPF action buttons, they are far different from other elements on the page. It’s not a group of buttons. It’s a button that loads several links to generate a dropdown
list-like something when onclick. Its affiliated links (such as “set to in development”) DO NOT exist before you click the button. They are loaded asynchronously.
General Sendkey function won’t work for this “dropdown list”. Other sendkey function provider (Mercury devicereplay, etc) will fail as well. Although when user manually focus the window and press keys everything work fine, sendkey function just won’t work. Fireevent “onclick” method remains the same. Perhaps it was due to wrong receiver. This phenomenon is common for webpage as limitation. You may have to use classical QTP recording/playback via regular expression rule or XPATH selector to trigger a click action on the “button”, and more important, do it after the elements have been loaded via AJAX.