Test Automation Frameworks in QTP and it Types, How to Create Test Automation Framework



Test Automation Frameworks in QTP and it Types, How to Create Test Automation Framework

Definition of Framework or the Introduction with Automation Frameworks:

What is framework? We will not discuss on bookish type definition but we will discuss with the following example regarding the frameworks of test automation.

We are sure that you have attended at-least a lecture / seminar or conference, where participant generally put some questions which are provided below.

  1. Participants should have attended their seat before the five minutes starting the lecture.
  2. Participants should bring his / her notebook and pen to write down the important points.
  3. First need to read about something from the books so that on the time of lecture participants could understand the presentation.
  4. Mobiles should be on silent mode.
  5. Exit gates should be used at the opposite end to the lecturer , If you require to leave the lecturer in the middle of the seminar.
  6. Any type of questions can be put at the end of the session.


So can you imagine that without observing these guidelines how you can conduct a seminar ???
You answer can be a big “YES”! Definitely you can manage the lecture / seminar / demonstration absence of provided above instructions. Even one more real fact is that all of use will not follow them even after there is laid …..

But if instructions will be followed, then definitely result or outcome will be beneficial like reduced distraction of audience during seminar and participant will increased the retention and understanding of the matter of subject.

So on the base of above clarifications, we can understand that a Frameworks is the set of guidelines or instructions which provides us full beneficial results if we followed them properly.
Test Automation Frameworks in QTP
Test Automation Frameworks in QTP


Now What is the Test Automation Frameworks?
Group or a set of instructions or guidelines like test data handling, coding standards, object repository treatments etc.. which required to follow during the automation scripting generates the beneficial results like increase the re-usage of code, reduced the script maintenance cost, higher portability etc. SO remember these are not rules and only just instructions or guidelines. But if you will not follow these then you will miss the full advantages what you could get.

Available various types of Automation Frameworks...
  1. Linear Scripting
  2. Test Library Architecture Frameworks.
  3. Testing Frameworks with Data-Driven.
  4. Table-Driven or Keyword-Driven Testing Frameworks
  5. Hybrid Test Automation Framework

  1. Record and Playback – The Linear Scripting
It is also known as the record and playback and the simplest among all the frameworks. Here for this frameworks Test lead will manually records each and every steps for automation (User Input and Navigation), Checkpoints will be inserted in the first round (This is called Validation steps) , Now recorded script can be play in multiple rounds.

For an Example: Just for example we are taking the login functionality for railway reservation application which has been logging successfully...

SystemUtil.Run "flight4b.exe","","","open"
      Dialog("Login").WinEdit("AgentName:").Set "MyTest"
      Dialog("Login").WinEdit("Password :").Set "Mercury"
      Dialog("Login").WinButton("OKAY").Click
      'Now Confirm window of Flight Reservation has browsed after the successful log-in
      Window("Flights Reservations").Check CheckPoint("Flights Reservations")


Advantages of Linear Scripting:
  1. Script can be generated in very fastest way.
  2. Don't require the expert of automation
  3. Testing tool feature can be learn in easiest way.

Dis-advantages of Linear Scripting:
  1. There is little re usability of scripts.
  2. Script will be hard coded for Test Data
  3. Huge Maintenance Nightmare

  1. The Test Library Architecture Framework:
It's also known as “Functional Decomposition” or “Structured Scripting”.
Also in this framework, initially scripts will be recorded by the “Record & Playback” Style. But after this scripts will be identified and grouped into the functions or methods. These functions are called Driver and will be called by the main test script by the different -2 ways to generate the different -2 test cases.

For example – Same example as above the will be changed by following way for Flights Reservations:

Function Login()
      SystemUtil.Run "flight4b.exe","","","open"
      Dialog("Login").WinEdit("AgentName:").Set "MyTest"
      Dialog("Login").WinEdit("Pasword:").Set "Mercury"
      Dialog("Login").WinButton("OKAY").Click
      End Function

Now, You can call such method from the main script as per following code:

'Driver Script
Call Login()

Other Function Calls / Test Steps


Advantages of Test Library Architecture Framework:
  1. Compare to “Record and Playback” code re-usability achieved in this “Structure Scripting” on higher level than the Record and Playback.
  2. The Automation scripts are cheap than the develop due to re-usability of code.
  3. Maintenance of Script is easier then other

Dis-Advantages of Test Library Architecture Framework:
  1. IT require an expert of Technically script coder for Test Library Frameworks.
  2. It require much time than the first one to prepare the test scripts and plan.
  3. Here also Code of Test Data is the hard Code available in script.

  1. Data Driven Testing Frame works:
With this Frameworks, Test Data is the different or separated thing which kept outside to the scripts but logic of test case included in the generated script. Test script read the records or data from the external files i.e. Excel file, ADO Object, SQL database etc and load into the variables available in scripts during the run of test script. Variables can be used for verification and input values. Test Script automatically created using Test Library Framework or Linear Scripting.

For an Example → Following two more new steps will be involved while developing the flights reservations screen of logic.

Step1 → First Create the Test Records or test data in any provided source i.e. following:


Agent Name
Password
John
Mercury1
Reena
MERCURY2
Habib
MerCURY3

Step2: Test Script development and integrated it with created Test Data / Record:

SystemUtil.Run "flight4b.exe","","","open"
      Dialog("Login").WinEdit("Agent Name:").Set DataTable("Agent Name", dtGlobalSheet)
      Dialog("Login").WinEdit("Password:").Set DataTable("Passwords", dtGlobalSheet)
      Dialog("Login").WinButton("OKAY").Click
      'Check Flights Reservations Window has browsed
      Window("Flight Reservation").Check CheckPoint("Flights Reservations")
      **Note “dtGlobalSheets” is the default excel sheet provided by QTP

Advantages Data-Driven Experiment Framework :
  1. Test script changes will not effect the Test Data or Record.
  2. One test case can be executed with the multiple sets of Data.
  3. There are multiple test scenarios which all can be executed by just varying the test record available in external data files as domination above.

Advantages Data-Driven Experiment Framework

  1. Test Scripts changes will not effect the test Data.
  2. Multiple sets of records can be used in Test Cases.
  3. Multiple various types of test scenarios can be executed by just varying the Test Record in any external Record Data file.

Dis-Advantages Data-Driven Experiment Framework
  1. It require more time to prepare test scripts and test data and plan.

  1. Table Driven or Keyword-Driven Testing Frameworks:
This framework required the development of keyword and data tables, test automation tool in dependency to execute them frequently. Test scenarios can developed without or with the application-under-test. In a keyword-Driven test, functionality is documented of application-under-test in require table as well as step-by-step instructions is also available for each and all test.

Keyword-Driven Framework have 3 basis components → i. Keyword, ii. Application Map, iii. Component Function.

What is Keyword or definition of keyword?
This is the type of action and can be processed on any GUI component. For example GUI Component Textbox have some Keywords or Actions like → VerifyValue, InputText, VerifyProperty etc and so on.

Definition of Application Map? Or the Definition of Application Map.
GUI Components got the name references from the Application Map. Application Map is directly mean to “Object Repository'.

What is Component Functional ? Or The Definition of Components Function.
These functions are used to interrogate or manipulate the GUI components. For an Example:- Like a function is working on the Click of Web Button for all error handling, Now Enter data in a Web Edit With all error Handling. Component methods can be application independent or dependent.

For an Example: Following example will clear your all required points for above definition:

Step 1: First we need to create a Data Table and this data table will be different to previous one. This data table will include the Actions also which will be performed on GUI objects and also corresponding arguments. Each row will represents one test step at least.


Object
(Application MAP)
Action
(KEYWORDS)
Argument
WinEdit(AgentName)
Set
TestMy
WinEdit(Pasword)
Set
Mercury
WinButton(OKAY)
Click

Window(Flights Reservations)
Verify
Exist



Step 2: Code Development in the Component Function Form:

After the creation of Data Table's, Now you simply require to develop a code program and generat the test script so that it reads for each step. Step will be executed on the based on the keyword contained the action field and error checking will be performed and relevant information will be logged. This set of Script and program would look related to the below pseudo code:

 Function main()
     {
                Call ConnectTable(Table Name) {   //Function Calling for connecting to the table.
                        while (Call TableParser() != -1)  //function Calling for extracting and Parsing values from the table.
                       {
                           values need to pass to appropriate  COMPONENT methods. Like Set(Object Name , Argument) ex. Set( AgentName , MyTest).
                       }
                }   
                      Call CloseConnection()   //Closing connection Function after all the operation has been performed or completed properlty.
      }   //main End

That's all will called the Keyword-Driven Framework.



Advantages for keyword-Driven:
  1. Very High Code Re-usability provided by it
  2. Test Tool in dependency
  3. Application Under Test in dependency, Same script will work for AUT.
  4. Test Designation can be possible without AUT or With AUT.

Dis-Advantages for keyword-Driven:
  1. Investment is very high on initial stage.
  2. It required High Automation Expertise which creates the keyword-Driven Frameworks.

Note That: Actually QTP is keyword-Driven Framework itself automatically, You can not get full test tool and application independence using QTP.

  1. Hybrid Test Automation Frameworks:
    This is the combination of multiple frameworks or we can say that it is the combination of above all the automation frameworks. In this framework we tried to remove all weakness of above frameworks and tried to pulling the all strength or advantages from them. So Max industry uses the functional decomposition function in the combination of keyword framework to improve their automation frameworks.
    i. Test Modularity Framework:
    Modules will be grouped together in this framework:
    Ex: Using the QTP Actions user can generate a modular script
    Sample of Script for Login
      SystemUtil.Run "flight4b.exe","","","open"
      Dialog("Login").WinEdit("AgentName:").Set "MyTest"
      Dialog("Login").WinEdit("Pasword:").Set "Mercury"
      Dialog("Login").WinButton("OKAY").Click
      ‘Script End

Main script will this function as follows - 
      RunAction ("Login[Argument]", oneIteration)

ii. Business Process Testing (BPT) – This frameworks divided the big business process in to the small little components which can be re-use multiple time on the requirement time. For example -Booking Flight process is divided into small parts i.e. Login screen, Finding the Tickets, Booking the Tickets, Payment and then finally Logout screen. So whenever on the requirement business process or any other different process can be reused . BPT facilities coordinate too much to the automation engineers




















Android Install Apps to SD Card Default
Developer vs Tester a fake competition


QTP TESTING STEPS How to Record a QTP Script






No comments:

Post a Comment

Popular Posts