Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dani Vainstein and Monika Arora Gautam 1 FR Project Building and Setting-up the Infrastructure.

Similar presentations


Presentation on theme: "Dani Vainstein and Monika Arora Gautam 1 FR Project Building and Setting-up the Infrastructure."— Presentation transcript:

1 Dani Vainstein and Monika Arora Gautam 1 FR Project Building and Setting-up the Infrastructure

2 Dani Vainstein and Monika Arora Gautam 2 Introduction The FR project ( Flight Reservation ) is designated for all “First Step” users, who want to learn how to use QTP like in the “real” world of automation testing. The FR step-by-step project will teach you: project design, use of advanced coding techniques, how to reduce script maintenance, use of modern testing methodologies, and much, much more. The FR project will teach you how to build an automation infrastructure, define a framework for the requirements of the A pplication U nder T est (AUT). You will learn about different types of testing including: Regression, Negative, and Sanity (or Smoke) tests.

3 Dani Vainstein and Monika Arora Gautam 3 Subjects/Topics covered The O bject O riented P rogramming (OOP) testing methodology. Build the automation infrastructure. Organizing QTP and test related artifacts a.k.a Project Folders Define a Global Scripting.Dictionary object. The A pplication U nder T est (AUT). QTP Options. Record and Run Settings configuration.

4 Dani Vainstein and Monika Arora Gautam 4 The OO Testing methodology First rule : Separate Data from Coding. Second rule : Separate U ser I nterface (UI) from business logic. Third rule : Business layer module never call another business layer module, as well as G raphical U ser I nterface (Gui) module never calls another Gui module. Utils Layer GUI Layer Business Layer Test Layer Data Layer

5 Dani Vainstein and Monika Arora Gautam 5 The Data Layer The data layer are data source files, thus can be Excel files, xml files or a database. Utils Layer GUI Layer Business Layer Test Layer Data Layer

6 Dani Vainstein and Monika Arora Gautam 6 The Utils Layer These are common or specific function libraries associated with the scripts. Utils Layer GUI Layer Business Layer Test Layer Data Layer

7 Dani Vainstein and Monika Arora Gautam 7 The GUI Layer Every GUI “Module” handles one GUI screen Every module handles all the available actions for the current module i.e. Get Data, Set Data, Check Data Utils Layer GUI Layer Business Layer Test Layer Data Layer

8 Dani Vainstein and Monika Arora Gautam 8 GUI layers schema G1 G2 G3 G4 G5

9 Dani Vainstein and Monika Arora Gautam 9 Business Layer The Business Layer supports a single business action. The Business layer module can call 1 to n GUI modules. The Business module acts like a controller for the GUI actions. One Business module can never call another Business module. Utils Layer GUI Layer Business Layer Test Layer Data Layer

10 Dani Vainstein and Monika Arora Gautam 10 Business Layer illustration G3 B1 G4 G5 G1

11 Dani Vainstein and Monika Arora Gautam 11 Test Layer The Test Layer is the engine and a procedure to parse the parameters required for a single test, and call to the required Business Layer Module. Every Module has a unique name, usually a process name i.e. AddNewCustomer. The implementation of the test is the same, for all the tests, beside the call to the business action. Utils Layer GUI Layer Business Layer Test Layer Data Layer

12 Dani Vainstein and Monika Arora Gautam 12 The Infrastructure – Project Folder If you work in a company, you should build this infrastructure on a network drive /shared drive/version control, with a daily backup. If You work with Quality-Center the infrastructure should be built within the Test Plan pane.

13 Dani Vainstein and Monika Arora Gautam 13 Mapping a Network Drive for Automation In the real world, we do have network drives. The best method I know, is to select a constant free drive i.e Q: and map the network drive to the physical location. By doing this you’ll save large strings paths for example, if you have a network path as the follows: “//server/company/division/project/unit/product/qa /qtp/automation”, map Q: to the automation folder. All the testers have to do the same. Now, your automation folder is in Q:\FR Believe me, this process can save you a lot of headaches!!!

14 Dani Vainstein and Monika Arora Gautam 14 Assumptions and Dependencies We are assuming that you don’t have Quality-Center. We are also assuming that you don’t have a “network” drive. So, always save your work. A good project starts with a good plan. This step is skipped assuming that we already have a test plan.

15 Dani Vainstein and Monika Arora Gautam 15 Suggested Infrastructure LIB RA TESTS RS DOC FR DAT SETTING RES BATCH ENV Automation BL GL FR – Flight Reservation Project LIB - Function Library Files RA – Reusable Actions  BL – Business Layer  GL – GUI Layer RS – Recovery Scenarios DOC – Documents DAT – Data Files ( xml, xsl ) SETTING – QTP Settings files. TEST – QTP Tests RES – Results Folder ENV – Environment files BATCH – Batch files from Batch runner or Multi-Tester Manager

16 Dani Vainstein and Monika Arora Gautam 16 About Reserved Objects Reserved Objects are QTP COM objects, that extend the capabilities of QTP i.e Reporter, SystemUtil, Parameter, Environment, PathFinder, Description VBScript objects are not “Reserved”, that’s why you don’t see the intellisense, and all methods and properties when you press the “.” However, you can insert VBScript objects or any COM object to Reserved Objects.

17 Dani Vainstein and Monika Arora Gautam 17 About Reserved Objects Inserting objects to reserved category makes QTP to load those objects. Don’t add unnecessary objects, you’ll pay with performance. Don’t do it on ADODB; your database will remain always open. In the next slide we will take the advantage of defining a new reserved object read more about Reserved Objects here : http://www.advancedqtp.com/2007/06/reserved-objects http://www.advancedqtp.com/2007/06/reserved-objects

18 Dani Vainstein and Monika Arora Gautam 18 GlobalDictionary Object The OO Methodology needs a data source during run- time. The solution is to define a Global Scripting.Dictionary Object for this purpose. If you don’t know what is a Scripting.Dictionary object, please! read related documentation, we are going to use it a lot see link: Scripting QTP - Advanced VBScriptScripting QTP - Advanced VBScript Another advanced option, is to use a disconnected record-set “ADOR.Recordset”; will not covered in this project.

19 Dani Vainstein and Monika Arora Gautam 19 Define a Global Dictionary Open the Registry editor ( type regedit in run command ) Locate the Key : HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects. Close QTP if it’s open.

20 Dani Vainstein and Monika Arora Gautam 20 Define a Global Dictionary Right Click on ReservedObjects and select from the popup menu New  Key In the newly created entry, type “GlobalDictionary” Add new String value ProgID = Scripting.Dictionary  Right-click on ProgID  Modify  Scripting.Dictionary ( in value data ) Add new String value UIName = GDictionary  Right-click on UIName  Modify  GDictionary ( in value data ) Add a new DWORD value VisibleMode = 2  Right-click on VisibleMode  Modify  2 ( in value data )

21 Dani Vainstein and Monika Arora Gautam 21 Define a Global Dictionary Global Dictionary Reserved Objects Key Path That is how your “ReservedObjects/GlobalDictionary entry will look.

22 Dani Vainstein and Monika Arora Gautam 22 QTP intellisence for Reserved Objects Always Restart QTP after modifying the Registry Type GDictionary. In the Expert View, you’ll see the intellisence for the newly created Reserved Object.

23 Dani Vainstein and Monika Arora Gautam 23 Shortcuts... You can define a.reg file that automatically updates the registry, on any new machine, so you don't have to do it manually. Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects\GlobalDictionary] "ProgID"="Scripting.Dictionary" "UIName"="GDictionary" "VisibleMode"=dword:00000002

24 Dani Vainstein and Monika Arora Gautam 24 Reg Settings File. LIB RA TESTS RS DOC FR DAT SETTING RES BATCH ENV Automation BL GL ReservedObjects.reg

25 Dani Vainstein and Monika Arora Gautam 25 Recommended Global Objects GloalFso You can use a "Log" file during the run-session DeviceReplay Simulates mouse and keyboard actions. Including Drag n Drop

26 Dani Vainstein and Monika Arora Gautam 26 Add-in Manager Select only ActiveX

27 Dani Vainstein and Monika Arora Gautam 27 The AUT ( Application Under Test ) Our AUT is the Flight Application Demo. The AUT embeds some ActiveX objects. When you first open QTP be sure that only ActiveX option is checked. Always open QTP before the AUT when working with ActiveX, otherwise new ActiveX objects will identified as WinObjects. Only One instance of AUT should be opened while recording.

28 Dani Vainstein and Monika Arora Gautam 28 QTP Global Options One of the most important options in QTP is to define the working path. This will allow you to use relative paths when working with tests, resources, data and more. If for some reason you want to move your project from C:\Automation\FR to D:\Automation\FR you just need to modify a single parameter, otherwise you’ll need to modify all tests, resources and associated repositories… you don’t want to do this, believe me.

29 Dani Vainstein and Monika Arora Gautam 29 Define a Working Path in QTP. Menu : Tools  Options  Folders Tab Shortcut: Alt + T + O Toolbar QTP Options

30 Dani Vainstein and Monika Arora Gautam 30 Define the Root Project Folder Root Project Folder

31 Dani Vainstein and Monika Arora Gautam 31 Recommended Options - Run Run Mode = Fast Allow other mercury… Save still image… For Errors and Warnings

32 Dani Vainstein and Monika Arora Gautam 32 Recommended Options - General Display Add-in manager Uncheck Automatically generate “With” statements…

33 Dani Vainstein and Monika Arora Gautam 33 Saving Option Settings LIB RA TESTS RS DOC FR DAT SETTING RES BATCH ENV Automation BL GL Options.vbs

34 Dani Vainstein and Monika Arora Gautam 34 View Options - General From Menu : Tools  View Options Show line numbers Auto indent Tab spacing = 4

35 Dani Vainstein and Monika Arora Gautam 35 View Options – Font and Color From Menu : Tools  View Options Courier NewSize = 10 or 11

36 Dani Vainstein and Monika Arora Gautam 36 Record and Run Settings When you click “Record” QTP will record anything you’re doing, until you stop recording. This can be very dangerous; QTP will add new objects to repository and new lines of code. We can accidentally overload the repository with private objects ( My outlook e-mails ), and with objects we’ll never use. Solution : Modify Record and Run Settings as explained in next slide.

37 Dani Vainstein and Monika Arora Gautam 37 Record and Run Settings Menu : Automation  Record and Run Settings… Record and run only on Applications opened by QTP Applications specified below

38 Dani Vainstein and Monika Arora Gautam 38 Record and Run Settings Menu : Automation  Record and Run Settings… Flight4A.exe Uncheck ”Launch Application” Include descendant processes

39 Dani Vainstein and Monika Arora Gautam 39 Summary The Infrastructure for the FR project is ready. For any question, please refer to the FR Project Forum.

40 Dani Vainstein and Monika Arora Gautam 40 Special Thanks To Natwarlal Asawa from India, Hyderabad Bharathi Babu from India, Pune Dinkar Singh from India, Delhi Ayyappa Koppolu from India, Pune Paul Grossman from USA, Chicago Sumit Singhal from India, Bangalore Sanjeev Mathur from India, Noida Manasa VN from India, Bangalore Prakash Kumar from India, Pune Suresh K from India, Bangalore Richi Sharma from USA, New Jersey Janardhan Kalvakuntla from USA, New England Joydeep Das from India, Hyderabad

41 Dani Vainstein and Monika Arora Gautam 41 Make sure to visit us for: Tutorials Articles Projects And much more @ www.AdvancedQTP.com


Download ppt "Dani Vainstein and Monika Arora Gautam 1 FR Project Building and Setting-up the Infrastructure."

Similar presentations


Ads by Google