Thursday, July 30, 2015

Connecting QTP to MicroStrategy????

I am trying to automate manual test cases written to validate reports created using MicroStrategy.

Manual Test Cases are to validate the label, rows count, data in the report is appropriate.

Currently we are planning to automate these test cases, but to begin, how are we going to connect QTP to MicroStrategy.


I got to know axis@work and GMIP tools could be use to validate MicroStrategy reports.
Right now our client is looking to use UFT/QTP, but any information on axis@work and GMIP tools should also help. 

Friday, July 24, 2015

Scenarios


  1.         DemoQA.com

1.      Go to the website
2.      Click on Registration link, and register the user
3.      Click on the Links on Interactions section:
o   Draggable – Go to Draggable + Sortable  - Move the item 1 under Item5 using mouse
o   Droppable – Go to Shopping cart demo – Select Lolcat Shirt from T-shirts drop in Shopping Cart. Dropped item should be seen in the Shopping cart.
o   Resizable – Go to Max/Min size – reduce the size of the window
o   Selectable – Go Serialize – select the items and selected items should be listed on the top
o   Sortable – Go to Portlets – click on minimize buttons on Feeds
4.      Click on Links in Widget section:
o   Accordian – Fill Space – Select Section 3
o   Autocomplete – go to Categories – click search field, enter ‘a’ and from the auto populate select ‘Antal’.
o   Datepicker – select field Date and select date from the pop up or calendar
o   Menu – click on Menu with Sub Menu – select News and then Sub Menu Item 2
o   Slider – In the Range slider, slide the slider so that bed room count displays 4
o   Tabs – Click on Tab2
o   Tooltip – Go to custom animation demo – move mouse over on ‘hide’, to see the tool tip ‘explode on hide’ is displayed
5.      Click on Frames and windows
o   Open New Window – click on New Browser Tab – to make sure a new window is displayed
o   Open Separate New window – click on Open new Separate window – to make sure a new tab is displayed
o   Frameset – click on Open Frameset Window -  make sure two frames are displayed
6.      Miscellaneous
o   Place cursor on Tools icon, the color of the icon should get changed(it gets blurred)
o   Check Tools icon is displayed. Image should be validated
o    
o    


7.      Do the above in chrome and IE


Scenarios from Internet:



Use QTP tool to automate below Test Scenarios?(Automate below test cases using QTP tool and save at your machine for evaluation)

  1.         Automate using QTP “login successful” functionality for Flight reservation desktop                   application
  2.        Automate validating “login unsuccessful” functionality for Flight reservation desktop                application using QTP tool?
  3. Using QTP automate validating “login successfully functionality” for three correct users names and passwords for Flight Reservation desktop application? Hint: You have to use QTP parameterization feature.
  4. Automate flight search functionality for Flight reservation desktop application? Hint: “Open an existing Flight reservation with particular order number”
  5. Automate booking new flight functionality for Flight reservation desktop application? Hint: “Insert new reservation and add checkpoint to check reservation inserted or not”
  6. Describe steps for automating “update existing reservation and check reservation updated or not?” functionality for Flight reservation system. Use QTP automation testing tool and automate this flow?
  7. Automate “gmail login successful” test case using QTP Testing Tool?
  8. Automate gmail login unsuccessful for all possible incorrect usernames and password scenarios” using QTP tool? Hint: You have to create one test case for each incorrect login and password scenario.
  9. Automate end to end flow for http://newtours.demoaut.com using QTP tool? Hint: End to end means login, booking flight, paying and exiting etc.
  10. Using QTP batch feature run gmail login successful and all login unsuccessful test cases in batch mode? Hint: Watch video and try to do this test case.
  11. Write a code that will capture Fly from and fly To drop down values..save to a user defined sheet and later Export the run time sheet to user defined Drive..


Sceanarios from diifferent source:





Thursday, July 23, 2015

Test Process with QTP --- Overall picture of how Automation scripts building will go



ATLM (automation life cycle) ---> Decison to automate Test -> Tool Aquisition -> Automation Introduction -> Test Design ->Test Exe and Mgnt ->Test Program Review assessment.


Source: http://www.qtp10.com/2009/06/qtp-testing-process.html

Here is how you will need to plan for automation:

The QTP (QuickTest Professional) testing process consists of the following main phases:
1. Analyzing your application
The first step in planning your test is to analyze your application to determine your testing needs.

  • What are your application's development environments (for example Web, Java, or .NET)? You will need load QTP add-ins for these environments to enable QTP to identify and work with the objects in your application.
  • What business processes and functionality do you want to test? To answer this, think about the various activities that customers perform in your application to accomplish specific tasks.
  • Consider how to divide these business processes into smaller units. You will be creating actions based on these tasks. Smaller and more modular actions make your tests easier to read and follow, and help ease maintenance in the long run.

  • At this stage, you can already begin creating test skeletons and adding actions to them.

2. Preparing the testing infrastructure
Based on your testing needs, you determine what resources are required and create these resources, accordingly. Resources include shared object repositories containing test objects (which are representations of the objects in your application), function libraries containing functions that enhance QTP functionality, and so on.

You also need to configure QTP settings so that QTP will perform the tasks you need, such as displaying a results report every time you run a test.

3. Building your tests and adding steps to them After the testing infrastructure is ready, you can begin building your tests. You can create one or more empty tests and add actions to them to create the testing skeletons. You associate your object repositories with the relevant actions, and associate your function libraries with the relevant tests, so that you can insert steps using keywords. You may also need to configure test preferences at this point.

4. Enhancing your test
Inserting checkpoints into your test lets you search for a specific value of a page, object, or text string, which helps you determine whether your application is functioning correctly.
Broadening the scope of your test, by replacing fixed values with parameters, lets you check how your application performs the same operations with multiple sets of data.
Adding logic and conditional or loop statements enables you to add sophisticated checks to your test.

5. Debugging, running, and analyzing your test
You debug a test to ensure that it operates smoothly and without interruption. After the test is working correctly, you run it to check the behaviour of your application. While running, QTP opens the application and performs each step in your test.
You examine the test results to pinpoint defects in your application.

6. Reporting defects
If you have Quality Center installed, you can report the defects you discover to a database. Quality Center is the HP test management solution.

RegisterUserFunc -- understanding and syntax

Understanding RegisterUserFunc Syntax with Example

Source: 
http://www.qtp10.com/2009/06/registeruserfunc-statement-in-qtp.html



You can use the RegisterUserFunc statement to instruct QuickTest to use your user-defined function as a method of a specified test object class for the duration of a test run, or until you unregister the method.


Note: If you call an external action that registers a method (and does not unregister it at the end of the action), the method registration remains in effect for the remainder of the test that called the action.

To register a user-defined function as a test object method, use the following syntax:
RegisterUserFunc TOClass, MethodName, FunctionName, SetAsDefault





Source:
http://www.automationrepository.com/2011/12/understanding-registeruserfunc-syntax-with-example/


In this article, we’ll have a look at the syntax of RegisterUserFunc statement. We’ll also try to understand the syntax with the help of an example.

Syntax
RegisterUserFunc TOClass, MethodName, FunctionName, SetAsDefault
ArgumentTypeDescription
TOClassStringThe Object with which you want to register the method. Eg: WebEdit, WebButton etc
Any test object class. 
Note: You cannot register a method for a QuickTest reserved object (such as DataTable, Environment, Reporter, and so forth).
MethodNameStringThe name that you want to use while calling the method. Eg: For a WebButton, it can be fnWebButtonClick

The name of the method you want to register (and display in QuickTest, for example, in the Keyword View and IntelliSense). If you enter the name of a method already associated with the specified test object class, your user-defined function overrides the existing method. If you enter a new name, it is added to the list of methods that the object supports.


My comments: Looks like you function(par) ... here par will be taken from object



GetHoverColor = oLink.Object.currentStyle.color
Here GetHoverColor  is a function, and the above line calls function and retrieves color
or
what does it do????
FunctionNameStringThe actual name of the user-defined function, i.e. the name that is used during function definition.
The name of the user-defined function that you want to call from your test. The function can be located in your test or in any associated function library.
SetAsDefaultBooleanOptional. Indicates whether the registered function is used as the default operation for the test object.  Default Value: False
Indicates whether the registered function is used as the default method for the test object. 
When you select a test object in the Keyword View or Step Generator (tests only), the default method is automatically displayed in the Operation column (Keyword View) or Operation box (Step Generator) (tests only).

Tip: If the function you are registering is defined in a function library, it is recommended to include the RegisterUserFunc statement in the function library as well so that the method will be immediately available for use in any test using that function library.


Example:

For example, suppose that the Find Flights Web page contains a Country edit box, and by default, the box contains the value USA. The following example registers the Set method to use the MySet function to retrieve the default value of the edit box before the new value is entered.


Note: Here first QTP will run SytemUtil -> Registers the Set method and connects with function Myset -> Browser class line, calls the function Myset -> as Set method is overridden by Myset it takes it parameter x as "Canada", as is called -> y will have initial value and x will have canada(it will set to the field).


Function MySet (obj, x)
       dim y
       y = obj.GetROProperty("value")
       Reporter.ReportEvent micDone, "previous value", y
       MySet=obj.Set(x)
End Function
SystemUtil.Run "http://www/mycontactform.com

RegisterUserFunc "WebEdit", "Set", "MySet"

Browser("MercuryTours").Page("FindFlights").WebEdit("Country").Set "Canada"

Setting.WebPackage("ReplayType") = 1 or 2 ?????

    Setting.WebPackage("ReplayType") = 2
        oLink.FireEvent "onMouseOver"
        GetHoverColor = oLink.Object.currentStyle.color
    Setting.WebPackage("ReplayType") = 1

Wednesday, July 22, 2015

Object ---Keyword -- when do you use Object in QTP???

MouseOver, Font, Color, Size, Background color,Change in Link color

Get the colour of the link after moving the mouse over the link on webpage

msgbox Browser("").Page("").Link("").Object.currentstyle.color    'Before moving the mouse over the link
Setting.WebPackage("ReplayType") = 2
Browser("").Page("").Link("").FireEvent "onmouseover"
msgbox Browser("").Page("").Link("").Object.currentstyle.color       'After moving the mouse over the link


The same way you can find the Font Size, Font Name  etc.

Browser("").Page("").Link("").Object.currentstyle.color
Browser("").Page("").Link("").Object.currentstyle.fontSize
Browser("").Page("").Link("").Object.currentstyle.fontFamily
Browser("").Page("").Link("").Object.currentstyle.backgroundColor

Monday, July 20, 2015

Using xpath in UFT

Browser("Flipkart").Page("Main Nav").Link("xpath:=//a[@data-tracking-id='electronics']")


Mouse Operations - Tool Tip

 - OnMouseOver: 

Browser("Registration | Demoqa").Page("Registration | Demoqa").Image("Tools-QA-213").FireEvent MouseOver  ????

The event is sent to the container of the ActiveX object and does not affect the ActiveX object itself. For example, simulating a click event does not actually perform the click.???

Source: http://www.joecolantonio.com/2011/06/07/qtp-how-to-use-the-fireevent-method-when-a-click-does-not-work/


Description:
The FireEvent method is designed to trigger events in an application.
Syntax: Valid Events:The Syntax for the FireEvent is:
yourObject.FireEvent EventName,[x-optional],[y-optional],[BUTTON-optional]
The events available when using the FireEvents method are:
  • onchange
  • onclick
  • ondblclick
  • onblur
  • onfocus
  • onmousedown
  • onmouseup
  • onmouseover
  • onmouseout
  • onsubmit
  • onreset
  • onpropertychange
Ex:
The click method below was not working:
Set mainPath = browser(“CB”).Page(“CB”)
mainPath.WebElement(“Search”).Click
…but using the FireEvent did work:
mainPath.WebElement(“Search”).FireEvent “ondblclick”

-  Source: http://www.learnqtp.com/capture-tool-tips-using-qtp-uft/

Tool Tip:
Attributes in the object spy - properties window will help you to find the tool tip text.

4 Ways to Capture Tool Tips using QTP (UFT)

Updated On Jul 7, 2014 by 

Beginners to QTP often get confused on how to capture tool tips from various UI elements. Since tool tips appear on mouse hover event, people often resort to using mouseover events, which in my opinion doesn’t give consistent results. In this article, we will talk about the generic process using which we can capture tool tips from various applications.

What is a Tool Tip?

Tool tip is a GUI element which is used to provide hints or brief details about an item when you hover a mouse on it. This item can be a link, image, edit box or any GUI element where application demands extra helpful hints.
Here is an illustration. A tool tip – Visit the main page – comes up when we hover our mouse on the logo of Wikipedia.
tooltip
Tool tips can be seen in all types of apps, whether web based or desktop based applications.

General Process of Capturing a Tool Tip

  1. Hover your mouse to check whether the UI element has a tool tip associated with it.
  2. If it has a tool tip associated, make use of QTP’s object spy tool and check the property that contains the tool tip value.
  3. Most of the times, you will find that tool tip is present in title property.
  4. Use GetRoProperty to fetch the tool tip value.

Capture tool tip from a link

We will make use of jsfiddle to show examples of tool tip usage.
tool-tip-link
As can be seen in the screenshot above, the title for link is defined as Go to home page. If you hover over the link – LearnQTP – you will see a tool tip titled “Go to home page”.
Let us use the process described above to capture this tool tip. Here is how the object spy looks for the link shown above.
object-spy-title

The corresponding code to fetch this tool tip would be:
msgbox Browser("Edit fiddle - JSFiddle").Page("Edit fiddle - JSFiddle").Frame("result").Link("Learn QTP").GetRoProperty("title")
You can play with various values here.

Capture tool tip from an image

We will make use of Google home page logo to demonstrate tool tip capture.google-tool-tip
In this case as well, the tool tip appears in the title tag.
object-spy-tool-tip
The corresponding code to fetch this tool tip would be:
msgbox Browser("Google").Page("Google").WebElement("India").GetRoProperty("title")

Capture Tool Tip Using XPath

The two cases we discussed above were simple for the fact that that ‘Tool Tip’ was directly available using Object Spy. There will be cases where the tool tip is not directly attached with the object under consideration. In such cases, we can take help of XPath.
HP introduced object identification capabilities using XPath in QTP 11 which has continued through UFT 12. To demonstrate tool tip capturing with XPath, we will use this website. The tool tip associated with the first name edit box is Your first name is a optional
tooltip-xpath-qtp-uft
If you Object Spy on this edit box, you won’t find the tool tip mentioned in any of the properties. Hence in this case, we will locate the property using XPath and the innerhtml propertyYou may ask, how should I write XPath expression? If you want a detailed tutorial on it check this article on XPath with QTP , if you are looking for an easier way read-on.
  1. Open this link in Google Chrome browser.
  2. Right click on the page and click on ‘Inspect Element’
  3. Use the little magnifying glass on the left and inspect ‘First Name’ edit box. Locate the tool tip in the console below.
  4. Highlight the row > Right Click > Copy XPath.
xpath-qtp-tool-tip
XPath associated with the First Name tool tip class is //*[@id=’tp1′]
This piece of code will give you the tool tip associated with First Name edit box using XPath.
msgbox Browser("ARIA Example: Tooltip").Page("ARIA Example: Tooltip").WebElement("xpath:=//*[@id='tp1']").GetROProperty("innerhtml") 

Capture Tool Tip Using CSS

Along with XPath, HP also introduced Object identification using CSS in QTP 11. The process for capturing CSS path for this element would remain the same. In this case, the CSS associated with First Name tool tip is #tp1
This piece of code will give you the tool tip associated with First Name edit box using CSS.
msgbox Browser("ARIA Example: Tooltip").Page("ARIA Example: Tooltip").WebElement("css:=#tp1").GetROProperty("innerhtml")
I hope this article will help you identify tool tips in your application. If you have used some other ways, please share in the comments section below.