Text of September 2009 QTP Automation Framework. Objective Introduction to Automation Benefits of...
September 2009 QTP Automation Framework
Objective Introduction to Automation Benefits of Automated Testing Automated Testing Process Introduction to QTP Framework Framework Structure Environment Supported
Introduction to Automation Drawbacks of Manual testing - Manual testing is time-consuming and tedious. - Requiring a heavy investment in human resources. - Time constraints often make it impossible to manually test every feature thoroughly before the application is released. - Low reliability. Manual Testing
Benefits of Automation Testing Why Automation - Fast - Reliable - Repeatable - Programmable - Comprehensive - Reusable Automated Testing
Automation Testing Process Automated testing involves three main steps Creating Script(s)Executing Script(s)Analyzing Result(s) The QTP testing process consists of 7 main phases: Preparing to record Recording a session on your application Enhancing your test Debugging your test Running your test Analyzing the test results Reporting defects
Introduction to QTP Framework What and Why What is an Automation Framework: A test automation framework is a set of assumptions, concepts, and practices that provide support for automated software testing. A comprehensive architecture to drive the complete test automation process. What is the need of having a Test Automation Framework: Pitfalls of available standard Test Automation tools. Testers are testers not programmers. Complexity and Maintenance. Test tool Costs. Test Automation is seldom a full time effort.
Automation Frameworks: Advantages Framework Advantages: Scalability Maintainability Removes most testers from automation complexities Can make automation efforts more holistic: Application independent Minimize Automation Risks Ensure Automation ROI
Type of Automation Frameworks Data Driven Framework Modularity Framework Keyword Driven Framework Hybrid Framework
Data Driven Framework Data-driven framework is one where test input and output values are read from data files (ODBC sources, Text files, Excel files, DAO objects, ADO objects, and such) and are loaded into variables that are coded in scripts Data Driven testing is implemented for applications whose behavior is data dependent- Test Scenarios are to be run one or more set of data values which vary for each execution cycle Data Driven Framework can be combined with Modular or Keyword Driven Framework to create a Hybrid Framework Type of Automation Frameworks Contd.
Modular Framework Requires creation of small, independent scripts that represents modules/sections/functions of the application under test. The modules are then used in a hierarchical or logical fashion to construct larger test realizing an actual test case. Features in QTP to support Modularity Framework: Reusable Actions Functional Libraries
Type of Automation Frameworks Contd. Keyword Driven Framework Keyword-driven testing framework refer to an application-independent automation framework. This framework requires the development of data tables and keywords, independent of the test automation tool used to execute them. The driver code "drives" the application-under-test, keyword driven test and the data. Keyword-driven tests look very similar to manual test cases. In a keyword-driven test, the functionality of the application-under-test is documented in a table like structure for e.g. Excel Sheet (similar to keyword view in QTP).
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 = Keyword Driven + Data Driven Hybrid Framework
Automation Framework- Typical Elements. Startup Script Driver Script Test Scheduler Object Repository Functional Library/Action Library Test Cases Test Data Files Environment Files Reporting Mechanism Exception Handling: Recover Scenarios
Startup Script Instead we have Initialization Script where you have to write your own VB Script to make QTP to run this script before executing each test. We can put start applications URL/Address/Exe file path in the default record or run settings for Windows/WEB applications. QTP opens immediately that particular application or URL will open.
Startup Script - Code
Driver Script Driver script is the single main script of the Driver Engine. It iteratively traverses through the data of business scenario flow and calls the respective reusable scripts sequentially. It also enables us to execute a reusable script any number of times in a particular data row of the variable test data sheet. It also updates the database for execution results of a particular script run
Driver Script - Code
Test Schedulers There can be situations when you need to schedule your QTP scripts so that they can run when you are not present in front of your PC.
Object Repository Object Repository acts as a translator between QTP script and the Operating System. QTP stores information it learns about a window or an object in object repository. When QTP runs a test, it uses the object repository to locate objects. QTP reads an object description in the repository and then looks for an object with the same properties in the application under test.
How QTP Stores Test Objects Object Repository Manager QTP TEST SCRIPT Generates Script Add objects using object Identification settings
Object Repository Contd. Types of Object Repositories: Per Action Object Repository Shared Object Repository
Object Repository Contd. Per Action Object Repository Object Repository TEST 1 ACTION 1 ACTION 2. ACTION - N TEST 1 ACTION 1 ACTION 2. ACTION - N Object Repository Object Repository Object Repository
Test Data As per the scenarios which are in regression test suite, enter all the required test data into the excel file and save it in the test data folder which is specified in the framework.
Reporting Mechanism When executing the scripts through QTP, we can get the HTML reports which is user friendly, where as running them through QC then auto generic reports.
Automation Framework Structure Manual Test Cases Manual Test Cases Feasibility Report on Test Scenarios Feasibility Report on Test Scenarios AUT Automation Scripts Automation Scripts Data Test Data Test Report Environment Library Object Repository Object Repository Recovery Scenario Recovery Scenario
Automation Work Flow Refactoring Manual Test Cases Feasibility Analysis Identification of Reusable Components Run The Automation Scripts from QC Create Automation Scripts Debug Automation Scripts Upload Scripts & Mapped To QC Test Report Analysis Create Reusable Actions or User Defined Functions Create Recovery Scenarios Create Test Data Create Shared Object Repository Level1 Level2 Level3
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.
Feasibility Analysis Sample_Feasibility_Report.xls Feasibility Report for a Test Case
Object Identification Tool Following is the list of mandatory properties that will be used for UI elements: UI ElementMandatory PropertiesOrdinal IdentifierSmart Identification Browsernamecreation TimeNo PagetitleindexNo Framename, titleNo WebEdithtml id, name, typeindexNo WebButtonhtml id, name, valueindexNo WebCheckBoxhtml id, name, typeindexNo WebRadioButtonGrouphtml id, name, typeindexNo WebTablehtml id, nameindexNo LinktextindexNo WebListhtml id, name, html tagindexNo Note : The list of mandatory properties for GUI elements may change if required.
Test Data Maintainance Test Data Sheet Name
Accessing Test Data Test Data is defined in separate excel files for each