Dani Vainstein & Monika Arora Gautam 1 Requirement Req0002 Implementation of Requirement Req0002.

Slides:



Advertisements
Similar presentations
Dani Vainstein & Monika Arora Gautam 1 Create a Test Set Mercury/HP Utilities.
Advertisements

Dani Vainstein & Monika Arora Gautam 1 Debugging Debugging your scripts.
Tutorial on Basic Usage
CPIT 102 CPIT 102 CHAPTER 1 COLLABORATING on DOCUMENTS.
Using Macros and Visual Basic for Applications (VBA) with Excel
The Web Warrior Guide to Web Design Technologies
Dani Vainstein and Monika Arora Gautam 1 FR Project Building and Setting-up the Infrastructure.
Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Tests Creation. Using the following QuickTest components  Designing Tests  Keyword View  Test Objects  Active Screen  Checkpoints  Object Property.
Automating Tasks With Macros
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Using the Visual Basic Editor Visual Basic for Applications 1.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
1 of 5 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Access Tutorial 10 Automating Tasks with Macros
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Panorama High School E.G.P./ Training to Put Students’ Grades on the Website Wednesday, September 29,
Automation Testing- QTP Rajesh Charles Batch No: Date: jan
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
JavaScript Form Validation
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
Dani Vainstein & Monika Arora Gautam 1 Utils Layer Building Library Functions.
05/09/ Introducing Visual Basic Sequence Programming.
Web Technologies Website Development Trade & Industrial Education
Dani Vainstein & Monika Arora Gautam 1 Requirement Req0001 Implementation of Requirement Req0001.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
1 CA201 Word Application Increasing Efficiency Week # 13 By Tariq Ibn Aziz Dammam Community college.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
1 Web-Enabled Decision Support Systems Objects and Procedures Don McLaughlin IE 423 Design of Decision Support Systems (304)
Chapter 6 Understanding the Structure of an Application: Procedures, Modules, and Classes.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Creating a Web Site to Gather Data and Conduct Research.
Chapter 2 More Controls Programming in C#. NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Dani Vainstein & Monika Arora Gautam 1 Req0009 Implementation of Req0009.
Dani Vainstein & Monika Arora Gautam 1 Requirement - Req0003 Implementation of Requirement Req0003.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Teacher’s Assessment Assistant Worksheet Builder Starting the Program
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Solmar Knowledge Networks Ltd. Automation Framework Marvell.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Using Advanced Options Lesson 14 © 2014, John Wiley & Sons, Inc.Microsoft Official Academic Course, Microsoft Word Microsoft Word 2013.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
Modal Dialogs. What is a Modal Dialog? A modal dialog is a separate window that remains in focus until it is closed by the user. During this time the.
PestPac Software. Leads The Leads Module allows you to track all of your pending sales for your company from the first contact to the close. By the end.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Quick Test Professional 9.2. Testing Process Preparing to Record Recording Enhancing a Test Debugging Running the Test and Analyzing the Results Reporting.
Input Boxes, List Boxes, and Loops Chapter 5. 2 Input Boxes Method for getting user’s attention to obtain input. InputBox() for obtaining input MessageBox()
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Perfecto Mobile Automation
Dani Vainstein1 VBScript Session 5. Dani Vainstein2 What we learn last session? Branching Branching using If … Then … Else statement. Branching using.
National Diploma Unit 4 Introduction to Software Development Procedures and Functions.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Dani Vainstein1 VBScript Session 8. Dani Vainstein2 What we learn last session? VBScript procedures. Sub procedures. Function Procedures. Getting data.
Excel Tutorial 8 Developing an Excel Application
Requirement Req0004 Implementation of Req0004
VBScript Session 6 Dani Vainstein.
Microsoft Office Access 2003
Tonga Institute of Higher Education
Presentation transcript:

Dani Vainstein & Monika Arora Gautam 1 Requirement Req0002 Implementation of Requirement Req0002

Dani Vainstein & Monika Arora Gautam 2 TIP Fr Project staff have made an improvement to the presentations. Whenever you see QTP code, right click the left bottom part of the presentation and do the follow : 1 2 Click

Dani Vainstein & Monika Arora Gautam 3 Topics covered Extending functionality on existing modules. Process design of a test. Build a new function. Adding single object to local repository. Checking single and multiple properties on an object. Standard and bitmap checkpoints. Create an initialization action. Create a generic login procedure. Call to an existing reusable-actions. Build a new test.

Dani Vainstein & Monika Arora Gautam 4 Before You Start… Before starting the presentation, read about the following topics in QTP help.  Window/Dialog Object - Exist Property.  Window/Dialog Object - Activate Method.  Reporter Object.  Environment Object.  SystemUtil.Run Method.  Exit Statement.  Const/Dim Statement.  Select Case Statement.  Desktop.CaptureBitmap Method.  CheckProperty Method.

Dani Vainstein & Monika Arora Gautam 5 Before You Start… Before starting the presentation, read about the following topics in QTP help.  If…End If Statement.  vbNullString Constant.  Object CheckProperty Method.  WinEdit, WinButton, Static Objects.  Standard Checkpoint.  Bitmap Checkpoint.  Checkpoint Properties.  Call to an Existing Action.

Dani Vainstein & Monika Arora Gautam 6 Req Overview User performs following testing on the ‘Login’ dialog. Before the user starts to enter any data :  Req0002a - Label “Agent Name” is visible.  Req0002b - Textbox “Agent Name” should be empty, enabled and focused.  Req0002c - Label “Password” is visible.  Req0002d - Textbox “Password” is empty and enabled.  Req0002e - Command Button “OK” is enabled.  Req0002f - Command Button “Cancel” is enabled.  Req0002g - Command Button “Help” is enabled.  Req0002h - Logo is displayed.

Dani Vainstein & Monika Arora Gautam 7 Req Overview Details Label displayed Label displayed Textbox empty Enabled and focused Textbox empty and enabled Command button Enabled. Command button enabled Command button enabled Logo

Dani Vainstein & Monika Arora Gautam 8 Process Design – Req0002 End Req0002a Passed Failed Report micFail Report micPass Req0002h Passed Failed Report micFail Report micPass No Dialog Login Exists? ExitTest Yes Report micFail Invoke App Start

Dani Vainstein & Monika Arora Gautam 9 Process Design – Req0002 First we need a regular invoke application process Then we need to verify that the “invoke application” process was done successful, before accessing the dialog. If the process failed, it means the login dialog wasn’t displayed and hence test is failed so there is no point to continue testing. Then the Req0002 process starts from Req0002a to Req0002h

Dani Vainstein & Monika Arora Gautam 10 Building a Generic Function - Application Invoke Process To implement the invoke application process we are going to use a function ( Utils Layer ). Why a function for invoke application? We are assuming that this process is necessary for all the tests.

Dani Vainstein & Monika Arora Gautam 11 Analyzing FR Application scenarios invoke Dialog “Login” Exists Window “Flight Reservation” Exist Activate Executable False True FalseTrueFalse TrueFalse True N/A

Dani Vainstein & Monika Arora Gautam 12 Activation Conditions 1. If “Flight Reservation” (main) main window is already displayed, don’t activate the executable file. We want to avoid multiple application instances. 2. If the “Login” dialog is already displayed, don’t activate. We want to avoid multiple application instances. 3. If “Login” dialog is NOT displayed AND the “FlightReservation” window is NOT displayed  activate Flight4x.exe. 4. Main Flight Reservation window and login are opened. This scenario case can never happened. Dialog “Login” and “Flight Reservation” window can’t be opened at the same time.

Dani Vainstein & Monika Arora Gautam 13 Application invoke considerations. The main thing we want to avoid when running scripts on Flight Reservation, is multiple instances of Flight Reservation application. Therefore we need the InvokeApp Function. Avoid This!!!

Dani Vainstein & Monika Arora Gautam 14 Application invoke considerations. InvokeApp function covers the following functionality  The function should check that no other instance/s are already open.  The function should contain generic process assuming that the application instance is probably open and working accordingly.  The function should also check a successful activation of the executable.

Dani Vainstein & Monika Arora Gautam 15 InvokeApp Design No Dialog Login Exists? Yes Report micFail End Start Flight Reservation Exists? Invoke App False No Dialog Login Exists? End False End True Yes

Dani Vainstein & Monika Arora Gautam 16 Adding Functionality to existing module LIB RA TESTS RS DOC FR DAT SETTING RES BATCH ENV Automation BL GL Fr.vbs Open the function library FR.vbs Menu : File  Open  Function Library Hotkeys : Shift + Alt + O

Dani Vainstein & Monika Arora Gautam 17 Creating InvokeApp Function Function Name: InvokeApp Type: Function Scope: Public execVersion By value Description Documentation

Dani Vainstein & Monika Arora Gautam 18 InvokeApp – Initialization Invokes application flight reservation version xx Invokes application flight reservation Public Function InvokeApp( ByVal execVersion ) Dim execPath, msg ' local variables ' initialization InvokeApp = False Initialize the function to false, as a default return value of the function

Dani Vainstein & Monika Arora Gautam 19 InvokeApp – Condition 1 ' ** condition 1 - Window displayed don't activate executable If Window( "regexpwndtitle:=Flight Reservation" ).Exist( 0 ) Then Window( "regexpwndtitle:=Flight Reservation" ).Activate micLeftBtn msg = "Flight Reservation is already displayed." Reporter.ReportEvent micDone, "InvokeApp", msg Exit Function End If Since we are using a generic function we are using Descriptive Programming ( DP ). If the “Flight Reservation” window exists, the window will be activated and a general message will be sent to the Reporter.

Dani Vainstein & Monika Arora Gautam 20 InvokeApp – Condition 2 ' ** condition 2 - Dialog Login is displayed don't activate executable If Dialog( "text:=Login","nativeclass:=#32770" ).Exist( 0 ) Then Dialog( "text:=Login","nativeclass:=#32770" ).Activate micLeftBtn msg = "Dialog Login is already displayed." Reporter.ReportEvent micDone, "InvokeApp", msg Exit Function End If If the “Login” dialog exists, the dialog will be activated and a general message will sent to the Reporter.

Dani Vainstein & Monika Arora Gautam 21 InvokeApp – Invoke executable ' ** invoking executable... execPath = Environment( "ProductDir" ) & APP_PATH ' build path... SystemUtil.Run execVersion, vbNullString, execPath, "open" Before using SystemUtil.Run method, we need to build the path of the executable, as the Run method requires this argument.

Dani Vainstein & Monika Arora Gautam 22 InvokeApp Function If Dialog( "text:=Login","nativeclass:=#32770" ).Exist( 5 ) = False Then msg = "Dialog 'Login' is not displayed after 5 seconds." Reporter.ReportEvent micFail, "ApplicationException", msg Exit Function End If InvokeApp = True ' Application was invoked Immediately after invoking, we’ll check that “Login” exists, with a max wait of 5 seconds, just in case… If the dialog didn’t show up after 5 seconds, this can be a defect, we fail the test, and exit the function. If the dialog exists, the function will return True.

Dani Vainstein & Monika Arora Gautam 23 InvokeApp – Final Look Add the function InvokeApp to File library. Save the function library You should have 2 functions.

Dani Vainstein & Monika Arora Gautam 24 Creating new step Open guiLogin test and add a new step Case “req0002” ( remember to write the string in lower case )

Dani Vainstein & Monika Arora Gautam 25 Implementing Req0002a Req0002a uses the CheckProperty method of static, with argument “visible”, value True The method will auto-report to Reporter object. Dialog( "Login" ).Static( "AgentName" ).CheckProperty "visible", True, 1000 ' ** Req0002a

Dani Vainstein & Monika Arora Gautam 26 Implementing Req0002b Req0002b checks 3 properties on 1 object viz. enabled, focused and text. It is recommended to use checkpoint for this purpose. However, many QTP developers prefer to use various CheckProperty methods instead of a checkpoint, because of the complexity and portability issue of managing checkpoints. This problem will be solved on QTP 9.5 Before starting to record, the Login dialog must be displayed. Make sure that only one instance of Flight Application is opened.

Dani Vainstein & Monika Arora Gautam 27 Inserting a Standard Checkpoint Start Recording :  Menu : Automation  Record.  Hotkey : F3  From toolbar as shown below: Record

Dani Vainstein & Monika Arora Gautam 28 Insert Standard Checkpoint Menu : Insert  Checkpoint  Standard Checkpoint… Hotkey : F12 Toolbar as shown below:

Dani Vainstein & Monika Arora Gautam 29 Insert Standard Checkpoint With the finger-point select the “Agent Name” WinEdit object.

Dani Vainstein & Monika Arora Gautam 30 Insert Standard Checkpoint Name : Req0002b enabled = True text = Timeout = 2 Except property enabled, text and focused, All the other properties must be Unchecked!! focused = True

Dani Vainstein & Monika Arora Gautam 31 Implement Req0002b Anytime you can mark the word Checkpoint and see the checkpoint properties. Dialog( "Login" ).WinEdit("AgentName").Check CheckPoint( "Req0002b" ) ' ** Req0002

Dani Vainstein & Monika Arora Gautam 32 Implementing Req0002c Req0002c uses the CheckProperty method of Static object, with argument “visible”, value True The method will auto-report to Reporter object. Dialog( "Login" ).Static( "Password" ).CheckProperty "visible", True, 1000 ' ** Req0002c

Dani Vainstein & Monika Arora Gautam 33 Implementing Req0002d Req0002d uses the CheckProperty method of WinEdit, with argument “enabled” value True, and “text” with value vbNullString ( represents an empty string ) Instead of using checkpoint we can alternatively add 2 CheckProperty methods. Dialog("Login").WinEdit( "Password" ).CheckProperty "enabled", True, 1000 ' ** Req0002d Dialog("Login").WinEdit( "Password" ).CheckProperty "text", vbNullString, 1000' ** Req0002d

Dani Vainstein & Monika Arora Gautam 34 Req0002e, Req0002f, Req0002g Dialog( "Login" ).WinButton( "OK" ).CheckProperty "enabled", True, 1000 ' ** Req0002e Dialog( "Login" ).WinButton( "Cancel" ).CheckProperty "enabled", True, 1000 ' ** Req0002f Dialog( "Login" ).WinButton( "Help" ).CheckProperty "enabled", True, 1000 ' ** Req0002g The requirement is only to check if they are enabled. don’t check any property that is not required. The method will auto-report to Reporter object.

Dani Vainstein & Monika Arora Gautam 35 Implementing Req002h After req0002h press ENTER to move to next line. In the end off the following line press enter Dialog("Login").WinButton("Help").CheckProperty "enabled", True, 1000 Make sure the cursor is on a new blank line, and then start recording. Before you start recording, make sure dialog Login is displayed. and only one instance of the application is opened.

Dani Vainstein & Monika Arora Gautam 36 Inserting a bitmap checkpoint Select Bitmap Checkpoint…

Dani Vainstein & Monika Arora Gautam 37 Inserting a bitmap checkpoint Select The Logo with the finger point. Select the Static and Click OK

Dani Vainstein & Monika Arora Gautam 38 Inserting a bitmap checkpoint Change the name of the checkpoint to “Logo”. Change the checkpoint timeout to 2 seconds. Click OK.

Dani Vainstein & Monika Arora Gautam 39 Inserting a bitmap checkpoint ' ** Checking the logo using bitmap checkpoint req0002h Dialog( "Login" ).Static( "Logo" ).Check CheckPoint( "Logo" ) The checkpoint syntax will be inserted automatically at mentioned location. STOP recording

Dani Vainstein & Monika Arora Gautam 40 Req0002 ( guiLogin ) – Final Look

Dani Vainstein & Monika Arora Gautam 41 Implement Business Action for Req0002 Open the busLogin test. Select the busLoginMng action. Insert a new test-case after case “req0001”. Use lower-case ( Case “ ” ) Select Case LCase( Parameter.Item( "busCode" ) ) Case "req0001" : Case "req0002" Case Else msg = "ActionCode parameter not implemented." Reporter.ReportEvent micWarning, "NotImplemetedException", msg ExitAction( micWarning ) End Select

Dani Vainstein & Monika Arora Gautam 42 Business Req0002 implementation According our design [ Process Design – Req0002 ] we need to invoke the application and then call the GUI process Req0002, We’ll call InvokeApp function from the test layerProcess Design – Req0002 What’s left now, is to call the “Req0002” GUI process located in guiLogin.

Dani Vainstein & Monika Arora Gautam 43 busLoginMng – Final Look As mentioned in previous presentation do not just copy this line of code, a call to an existing reusable action is required. add the input parameter “Req0002”,while calling the existing action guiLogin.

Dani Vainstein & Monika Arora Gautam 44 Create Req0002 Test Open a new blank test and save it under TESTS\Req0002 Req0002 LIB RA TESTS RS DOC FR DAT SETTING RES BATCH ENV Automation BL GL

Dani Vainstein & Monika Arora Gautam 45 Test Settings Modify the test settings…

Dani Vainstein & Monika Arora Gautam 46 Associated function libraries If you don’t see the LIB\FR.vbs file associated you must to permanently associate the function library; For instructions how to permanently associate function libraries, see previous presentation.

Dani Vainstein & Monika Arora Gautam 47 Test Header '*********************************************************************** : advancedQTP Created : Version : 9.2 : The test covers the requirement Req0002 Parameter : None. Parameter : None. Libraries : FR.vbs : ActiveX :, Date: > (Later modification on top) ', Date: '***********************************************************************

Dani Vainstein & Monika Arora Gautam 48 Implementing Test Req0002 The Initialization part is exactly the same for all tests. Option Explicit Dim msg Call Initialization() If Reporter.RunStatus = micFail Then msg = "Initialization Process Failed." Reporter.ReportEvent micFail, Environment( "TestName" ), msg ExitTest( micFail ) End If

Dani Vainstein & Monika Arora Gautam 49 Implementing Test Req0002 A call to function InvokeApp is required to activate the executable file. ' ** invoking application Call InvokeApp( Environment.Value( "EXE_FILE" ) ) If Reporter.RunStatus = micFail Then msg = "Invoke Application Failed." Reporter.ReportEvent micFail, Environment( "TestName" ), msg ExitTest( micFail ) End If

Dani Vainstein & Monika Arora Gautam 50 Insert a Call to Existing Action

Dani Vainstein & Monika Arora Gautam 51 Insert a Call to Business Module

Dani Vainstein & Monika Arora Gautam 52 Insert a Call to Existing Action After the current step Use relative path busLoginMng

Dani Vainstein & Monika Arora Gautam 53 Req0002 Test – Final Look Do not forget to check syntax before closing action

Dani Vainstein & Monika Arora Gautam 54 Result Req0002

Dani Vainstein & Monika Arora Gautam 55 What’s Next? Implement LoginRegression Test. Req0003. Calling an existing library function. Creating an external data source. Loading an external data source. Create a dynamic standard checkpoint.

Dani Vainstein & Monika Arora Gautam 56 Special Thanks To Tali Hizkia from Israel, Tel-Aviv. Bharathi Babu from India, Pune. Dalvinder Matharu from USA, San Jose. Mike Manchester from USA, Bolivar

Dani Vainstein & Monika Arora Gautam 57 Make sure to visit us for: Tutorials Articles Projects And much