Saturday, March 26, 2011

QTP 9.2 QnA Part-I


Question 1- What are the Benefit of automation testing
Answer- As a summary automation testing offers following advantages which manual testing does not
1- Reusability
2- Consistency
3- Productivity

Question 2- What is the general workflow of QTP
Answers- step by step workflow is:
1-      Prepare the automation test environment
2-      Record user action to generate the basic test
3-      Enhance the automation test for play back and testing
4-      Run test/multiple test

Question 3- What is keyword view and Expert view in QTP?
Answer- keyword views shows exact recording of the applications (in tabular format) and the interface divided into
1)item
2)operation
3)value
4)documentation

while in expert view VB Scripting is displayed.

Question 4- To which environments does a QTP support?
Answer- Quick Test Professional supports functional testing of all enterprise environments, including Windows, Web,..NET, Java/J2EE, SAP, Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe terminal emulators, and Web services.


Question 5- What is Add-in manager in QTP?
Answers- When you launch your QTP, you will find an option called "add-in-manager" there you can load your add-in. It depends on your license that what the list of add-in coming there. By default in QTP 9.2 three Ad-ins comes and these are: ActiveX, Visual Basic and Web. IF none of the add-ins are checked in the Add in Manager of QTP then Standard Windows Environment will be loaded by default.

Question 6- Why do you select Allow Other Mercury Products To Run Tests And Components?
Answer- If you want to run test from QC test lab you need to enable this option.

Question 7- What access permissions do the test and testers to have?
Answer-
• Database
• Host systems
• Input/output data

Question 8- What are the different framework we can use using QTP?
Answer- There are different types of framework we use in QTP.
1. Datadriven framework
2. Keyword driven framework
3. Module driven framework
4. Hybrid driven framework

1- Datadriven framework- This frame work is used when an application is test with multiple sets of data. The data is passed to the scripts from data files like excel files, csv files, ODBC (Open Database Connectivity) and ADO (ActiveX Data Objects) objects
In other words, The Execution of an automation program on a software build with multiple test data is called as "data driven testing"

2- Keyword driven framework- Keyword-driven testing is a testing methodology where every action to be performed is described by a keyword. All these keywords defines the object, the action works with. These keywords are also called actions or commands.
The keywords based testing is a kind of alternative of scripting.


Question 9- What are different modes of recording in QTP?
Answer- there is three modes of recording in QTP
1-      Normal
2-      Analog
3-      Low level

1-      Normal Mode- It’s a default recording mode. It is also called Context Sensitive Recording. In QTP we generally use over 95% of recording in this mode only.
It is used to record the operations on standard GUI objects. For each and every operation it generates script. In this mode QTP learns the properties of an object and stores them in the object repository for object identification at run time.

2-      Analog Mode- In this we can records the exact mouse and keyboard operations performed in relation to either the screen or the application window.

3-      Low level Mode- This mode enables you to record on any object in your application, irrespective of  QTP recognizes the specific object or the specific operation.


Question 10- What are the different run modes in QTP?
Answer- there is three run modes
1- Verify: - to save the results of the test run to compare and verify with the future runs of the same test
2- Debug: - to save the results as he is yet to finish the script or he is testing his QTP coding logic
3- Update:- to update the expected results while running the test, say for example while recording the script the calendar date was 10/20/2002 and while executing the test it is a different date (system date), then the test should be run in the update mode other wise the test would fail because of the changed properties of the object.

Question 11- What is the concept of object and in QTP?
Answer- In general Object is an instance of a class and each object has properties and methods. Now in QTP all these objects are stored in a Object repository. There are some predefined object stored are called slandered objects and can not be changes or modified.
There are two types of Object
1-      Test Object :- A test object is an object which created by QTP in the test correspond to actual object in the application. This stored information will be used by QTP at the time of run session to identify and check the object
2-      Run time Object:- Now the real object in the application on which the method are performed at the time of run, are called Run time objects.

Question 12- What is the object repository in QTP?
Answer- Object repository is the storage space for Objects. OR works as interface between application and tool. Any OR generally consists of:
1- Logical Name- A name given to the object
2- Physical description- The object detail or u can say the properties of the object which is used to identify this object during run time.

Question 13- What are the two types of repository in QTP?
Answer- In QTP there are 2 object repositories, they are

1.Shared Object Repository (Global Object Repository)- A shared object repository stores test objects in a file that can be accessed by multiple components (via their application areas) in read-only mode.
The extension for such OR is “.tsr”   -- Test Script Repository


2.Local Object Repository (Per-action repository)- A local object repository stores objects in a file that is associated with one specific component, so that only that component can access the stored objects.
By default it’s a local object repository. Whenever we create an action, an object repository is created by default for this action.
The extension for such OR is  “.mtr”  -- Modular Test Repository or mercury test repository


Question 14- What is Object spy and how it is used?
Answer- Object spy is used view the run & test time object properties & methods of the application under test.
To select object spy navigate to tool bar and select object spy or In the Object Repository Window Click the Object Spy Icon. Once spy is selected a hand will come. Once you click on an object all the properties of the object is listed in the Object Spy Window


Question 15- How Quick Test Recognizes Objects?
Answer- QTP recognizes all objects in the Application under test using the set of mandatory properties that it stores for all Test Objects while recording. If QTP is not able to recognize the objects using the set of mandatory properties it uses another set of properties called the assistive properties. Incase the assistive properties are also not enough to uniquely identify an object QTP resorts to using the ordinal identifiers for the object that are properties like the index location and time of creation of the object. If all this fails, QTP resorts to the smart identification mechanism.

Sunday, September 5, 2010

Configuring Selenium RC with TestNG using eclipse

Recently I was trying Selenium RC with TestNG using eclipse. I found it little tough without any proper step by step documentation. I took help of my collegues and completed. In fact I am not using this tool in my project but I always try to find time to work with selenium. After all you can not stop your learning :)
This tool is pretty good and rapidly taking place in market.

Any way I had successfully ran a sample test case using TestNG in eclipse with selenium RC. While it was starting but decided to post one article on “Configuring Selenium RC with TestNg using eclipse” to help testers those who want to start with same. I also maintain my blog as a database for self reference. So if you find it beneficial for you, you can write few words and if not then you can ignore :(



Finally here, step by step process to configure and run your first java test using TestNG and selenium RC in eclipse

1- Install JRE http://www.java.com/en/download/
2- Download eclipse http://www.eclipse.org/downloads/
3- Download TestNG http://testng.org/testng-5.14.zip
4- Download selenium RC http://seleniumhq.org/download/
5- Launch you eclipse

The workspace, you can select any working directory. In my case it’s “Selenium_Project”


Now clicking on Ok button, it will launch eclipse.




6- Install TestNG plugin

Go to help->install new software






Click on add. This will open a small window where you need to put location “http://beust.com/eclipse”.

Click on OK. You will see that an entry is added there. Now tick that box and click on next.



7- Add project

Click File->new->Java project

Give project name and finish


 

 
This will create project “MyProject”




8- Add TestNG jar to library

Select MyProject and then Go to (menu bar) project->properties->Java build path->Libraries



Click on add external JARs and add TestNG jar file (testng-5.14.jar) from folder which you get after downloading TestNG in step#3.



9- Add Selenium RC jar to library

Add selenium Jar file same way we have added testNG jar. Selenium jar file can be found in the “selenium-java-client-driver-1.0.1” folder which you get after downloading it in step#4.





10- Add Class file

In MyProjectt right click on scr folder then new->class


Name the class (e.g Login) and finish.


Now add your test code here under this class. As in my previous article I had mentioned that you can simply record your test using IDE and pick java code and use here. For more detail refer : http://vishalsachan.blogspot.com/2010/06/hi-folks-sorry-for-bieng-inactive-from.html



11- Run test

Run your clas file as TestNG





Ohh i forget one step here. before executing test/running class file you need to start selenium server. thia is similar to every time so i am just copying it from my previous article.



To start the selenium test server, first go to the location where your JRE is placed. For example
C:\Program Files\Java\jre6\bin\
and then Run the command java -jar selenium-server.jar
here it is supposed that you have placed your selenium -server.jar file in same location. In case if you have placed it in other location you can run it in following way:

C:\Program Files\Java\jre6\bin\java -jar jar “E:\SELENIUM\selenium-remote-control-1.0-beta-1\selenium-server-1.0-beta-1\selenium-server.jar”

This will start you selenium server.


Thanks.
 

Thursday, July 1, 2010

Selenium IDE: Use XPath if no id found in elemnet you want to work with

If you are working with IDE and recording your script. There may be some cases where you IDE can not record the action to the element that do not have any id. In such case you need to find the id manually and provide it to the script to cover your action. XPath help you here to navigate your site.

In one of my project when I was recording my script for create a post, I found that IDE is unable to record the text box activity. Actually that text box was Javascript content editor 'Tinymce' . Later I recognized that IDE is unable to find this editor as there was no label used for this. So I used X paths to locate the element ID. It looks like..
id('commentBodyField')

The XPath can be found using the Firefox plug-in. https://addons.mozilla.org/firefox/addon/1095
to find the XPath just right click over the desired element and click on view Xpath.