By Rafaela Azevedo
Today I will show how identify all the tasks that are common in most of the test cases you automate in QTP.
I will use the example of login in Gmail:
So, we have these actions and these fields/buttons:
Like in Selenium, you have to identify the objects as unique, before entering the email id, you should know that which of the two text boxes in the Gmail Login screen is the ‘Email’ field. Once you correctly identify the email field, you can then enter email id in that field. Consequently, you should try to find out the unique properties which are available with that object only.
QTP provides a unique mechanism using which you can identify the unique properties of the objects. This mechanism is called Object Spy. Along with this, QTP also provides a storehouse called Object Repository where you can store these objects together with their properties.
Now, you can perform some actions in each control, like a button you can click and each control has your action. But if the field is a textbox or combobox ? So, you can click in the control and choose if you want to put some text/data or if you can choose the data in a list.
QTP has its own set of pre-defined function libraries that contain all the operations associated with different objects. QTP also provides an intelli-sense option where when you write an object in your code, QTP will automatically show all the functions and properties associated with that object.
QTP has its own inbuilt mechanism called Data Table where you can save the test data and later use it in the test scripts. QTP provides its own set of functions using which you can retrieve data from the Data Table.
Even if your data is stored in some external files such as Excel sheets or XML files, QTP provides you with many methods using which you can fetch data from these external sources.
Like any language, you should need to combine all individual operations together and execute them.
QTP also provides many methods which you can use to store your reusable and non-reusable code. These mechanisms are –
– Actions: Actions are one of the most common ways in which you can save code in QTP. You can save both reusable and non-reusable code in Actions.
– Function Libraries: Function Library is another very popular method that you would use in almost all your QTP projects. Function Library is primarily used to store reusable code.
– Business/Scripted Components: Though used less frequently, this is one more place where you can store your code.
Very easy, isn’t it ? This is the basic to introduce QTP. If you have some doubt, you can to write below !
Thank you :)