23
Hybrid Framework Sudhakar.Mangi )

Hybrid framework

Embed Size (px)

Citation preview

Page 1: Hybrid framework

Hybrid Framework

Sudhakar.Mangi

)

Page 2: Hybrid framework

2

Hybrid Framework

The most successful automation frameworks generally accommodate both keyword driven testing as well as data driven scripts.

Hybrid is a combination of Functional Decomposition and Data Driven Framework.

Modularity can be achieved by nesting the test scripts and using library files to implement reusable components (Reusable Actions and Functions).

Hybrid = Modularity + Data Driven

Hybrid Framework

Page 3: Hybrid framework

3

Frame work Features

Better ROI

Internalization support

Support multiple projects/Test Suites/Test cases

24/7 Automatic Regression Test Running Facility

Generates Email Reports

Generates Test Logs

Easy to Maintain

Screen Capturing Files

Easy to build automation for the project

No scripting skills required for End user

Page 4: Hybrid framework

4

ARCHITECTURE OF A HYBRID FRAME WORK

Scenario Driver

Script Driver

Test Scenarios

Test cases

Screens

Application ScriptsCore Framework

AUT

Repositories & Recovery

Lib File

Config file HTML and CSV Report

XLFilev Script TD Exec

Admin TC1 1-2 Y

Admin TC2 3-6 N

Admin TC3 2,5,6 Y

Scenario Sheet

XLFilev Script TD Exec

Admin TC1 1-2 Y

Admin TC2 3-6 N

Admin TC3 2,5,6 Y

Test Script Sheets

Page 5: Hybrid framework

5

Core Framework Layer

The Core Framework Layer Is independent to any application and can be reused for

automation of every web based application. Core Framework Layer Consists of the

following components that cab be reused across all Applications

Scenario Driver

Script Driver

Keyword Functions

Report Library

Page 6: Hybrid framework

6

Application Layer

The Application Layer consists of the following components that have to be filled with

Keywords and Test Data based on the test cases to be automated for given

application.

Object Repository Files

Scenario File

Script Files

Config File

Recovery Files

Page 7: Hybrid framework

7

Framework-Flow

Framework starts its execution by calling the scenario driver. Scenario Driver loads

Library File like Report Library and Keyword functions Library. This also loads Config

file which contains information path of the repositories, Path of the script files

etc.Apart from this Scenario driver also loads scenario file which contains the list of

scenarios and scripts to be executed

From the Loaded scenario file each scenario will be consider one after the other for

execution if execution is ‘Y’, then scripts under scenario will be executed. Else

Scenario Driver goes to the next scenario

Page 8: Hybrid framework

8

Framework-Flow

The best part in our frame work is you can even control which test script to be

executes by defining the execution status as Y or N..If script execution status is Y

then corresponding script sheet will be loaded into automation tool and run each step

in the Test Script File. In Test Script File we will find many columns like Step, Object

Name, Object Type,Operation,TD_1,TD_2,TD_3 etc.Columns TD_1,TD_2 represent

the test data to be used in the Test Script. One more excellent feature about our

frame work is we can even control the test data to be used while script is executing.

User can specify the Test data Columns to be used in scenario file against the Test

Script in the column Test Data. User can specify each test data column to be used or

he can also specify the range of columns to be used

Page 9: Hybrid framework

9

Framework-Flow

Corresponding to each keyword written in the test script we can find the Keyword

functions in Library File WEBkeywords.Script driver calls there Keyword Functions

and perform the operations on the object. Before we perform operation on the object

of any page we will set the page to be used with function setBrowserPage. This

function also loads the repository corresponding to the page since Page name is

same as object repository name. Other words we maintain one repository for each

page

While framework is executing status of each script execution will logged to the HTML

file which is stored in the results folder.Our results file is very detailed which contains

Scenario name, test cases executed for each scenario, description of test step

executed, Results of the test step PASS/FAIL. Results summary will also be stored

in CSV file along with detailed HTML report

Page 10: Hybrid framework

10

Folder Structure

Application Name

Main

Scenario

Scripts

Recovery

Repositories

Results

Page 11: Hybrid framework

11

FLOW DIAGRAM

Below is the Flow Diagram of frame work Execution

Start Scenario Driver Script Driver

Keyword FunctionsReport ResultsStart

Page 12: Hybrid framework

12

Automation Work Flow

Refactoring Manual Test

Cases

Refactoring Manual Test

Cases

Feasibility Analysis

Feasibility Analysis

Identification of Reusable

Components

Identification of Reusable

Components

Run The Automation

Scripts from QC

Run The Automation

Scripts from QC

Create Automation

Scripts

Create Automation

Scripts

Debug Automation

Scripts

Debug Automation

Scripts

Upload Scripts & Mapped To QC

Upload Scripts & Mapped To QC

Test Report Analysis

Test Report Analysis

Create Reusable Actions or User

Defined Functions

Create Reusable Actions or User

Defined Functions

Create Recovery Scenarios

Create Recovery Scenarios

Create Test Data Create Test Data

Create Shared Object Repository

Level1

Level2

Level3

Page 13: Hybrid framework

13

Feasibility Analysis

Formal selection of manual test cases for automation:

Decision will be been taken on what can be automated and what cannot be automated.

Selection of the test cases to be automated will be based on the business risk attached to each

test

Tests that need to run once and those that need frequent human intervention are usually not

worth the investment to automate and need not be considered for automation

Avoiding business scenarios where complex hardware is involved

Sample feasibility analysis report.

Page 14: Hybrid framework

14

Feasibility Analysis

Sample_Feasibility_Report.xls

Feasibility Report for a Test Case

Page 15: Hybrid framework

15

Accessing Test Data

Test Data is defined in separate excel files for each application in Move

Test Scripts written in QTP will access the Test Data using QTP’s Data Table feature.

Test data defined in separate excel files will be imported into QTP’s Data Table.

Importing Test Data from external excel files will be done using an import statement.

Following syntax used to import a sheet from test data.xls file to a sheet in data table

Syntax : Datatable.ImportSheet “Location of TestData.xls file”, “sheet ID in Testdata.xls file” , “Sheet id/sheet name in data table"

Example: Datatable.ImportSheet “C:\Testdata.xls”,3, “Login"

Page 16: Hybrid framework

16

Reusable Components

There are two types of Reusable Components

Reusable Action User Defined Functions

Generic Functions Business Functions

Reusable Actions and User Defined Functions are maintained in separate folders for entire application.

The advantage of using Reusable Actions is that it can be easily debugged and can use the intelligence feature of QTP IDE.

All common scenarios will be captured using Reusable actions.

Functions will be used for performing generic tasks e.g. like splitting a string, etc. These tasks are application independent.

Page 17: Hybrid framework

17

Environment File

Environment files are also called as initialization files or configuration files.

Environment files are created in external files with .xml format

Create Environment variables to access information like Server Name, Application URL, username, password, library files and Test Data.

This file can be used across all the called Actions and in all the Test Scripts.

Throughout the test the value of an Environment Variable remains the same.

Page 18: Hybrid framework

18

Environment File Contd.

Page 19: Hybrid framework

19

Main Test Runner Structure

Test Components of each Module Test ResultsTest Results

Main Test RunnerEnvironment File / Initialization file

Test Scripts

Object Repository

Test Data

Reusable Actions

User defined functions

Generic Functions

Generic Functions

Test Suite1 (Ex. FH)

Page 20: Hybrid framework

20

Test Execution

New Change Request

Update Test Cases as per

CR

Quality Center

New / Modify QTP Test Scripts

New / Modify Master Scripts

Test ResultsTest Results

Test Data for the CR

Object Repository

Reusable ActionsReusable Actions

User defined Functions

Recovery Scenarios

Page 21: Hybrid framework

21

Exception Handling: Recovery Scenario

Exceptions are conditions which stops test script execution

Exceptions might occur at any time during script execution

Exceptions in QTP can be handled by using any one of the following two methods i) Recovery Scenarios

ii) On Error Resume Next statement

Recover Scenarios will be implemented on all the modules.

Recovery Scenarios can be defined using Recovery Scenario Manager in QTP.

Application specific Recovery Scenarios like recovery from security warning, unknown pop-ups etc will be defined using Recovery Scenario Manager

Page 22: Hybrid framework

22

Reporting Test Result

Results of the Automation Scripts will be reported using Reporter Utility object

Results are reported at test case level and at every important state of the application.

Syntax: Reporter.ReportEvent <status>,"Scenario/Case Name“ ,“Scenario/Case description”

Status can be either micpass or micfail or micdone or micwarning

Example: Reporter.ReportEvent micPass,"Login Scenario","Auditee Logged In Successfully” Sample results snapshot that is reported using Reporter.ReportEvent statement is shown

Page 23: Hybrid framework

23

THANK YOU