Sunday 13 April 2014

Script Naming convention and Coding standards

1.0         Purpose

An automated test script can be viewed as a full fledged program. Hence, like any other program in C, C++, Java etc, this script/program would undergo review (CWT), modifications etc. For a person to review or modify it, it’s obvious that the person understands the script thoroughly and there are no confusions. For that, the script should strictly follow standards for naming and coding.

This document explains the standards to be followed for-

  1. Script header
  2. Naming:
    1. Script
    2. Code variables
    3. Data table variables (column headings)
    4. Test objects (in the Object Repository)
    5. Report output file
  3. Coding:
    1. Commenting
    2. Indentation
    3. Decision statements (IF)
    4. Loops (WHILE, FOR etc)
    5. Database querying

2.0         Script Header

The test script header should have following details:

‘Name of the script:                               <Name of the script>
‘Name of the application and/or module:            <Name of the application for which the test is being written>
'Author:                                                 <Name & of the Author>
'User id:                                                <Author’s CEC id>
'Created on:                                          <Date (dd-mon-yyyy) on which this code was created>
'Purpose:                                              <Why this piece of code has been written>
'Input:                                                   <What are the input parameters (if any)>
'Output:                                                            <What are the output or return parameters (if any)?>
‘Pre-conditions:                                     <What are user accesses required, desktop/QTP settings, Test environment specifics etc>
'Modified:                                             <1. Date Modified, Logic modified>
'                                                           <2. Date Modified, Logic modified>
                                                            .
                                                            .                                                            .
Note: Each place that you modify the code, please write the number as in modified and then write the code.

3.0         Naming standards

Following are the naming standards for the various entities-

3.1         Script

The script name should be in the format TestXXX and should follow a Hungarian notation.
E.g. TestMaxlengthValidations

3.2         Code variables

The code variables should be named based on the data type as below-
Boolean            bln        blnFound
Byte                 byt       bytRasterData
Date (Time)       dtm      dtmStart
Double             dbl       dblTolerance
Error                 err        errOrderNum
Integer              int         intQuantity
Long                 lng        lngDistance
Object              obj       objCurrent
Single               sng       sngAverage
String               str        strFirstName

3.3         Data table variables (column headings)

Inputs:
If a data table field is being used to store an input for a form, it should be named as “dt_in_<corresponding test object name>”.
E.g. if the form field <Template> has a corresponding test object (in the OR) as <Template>, the data table field should be named as “dt_in_Template”.

Expected results:
If a data table field is being used to store an expected result, which may output as a field value, static text or message, it should be named as “dt_out_<corresponding test object or form field name>”.

3.4         Test objects (in the Object Repository)

The test objects in the object repository should preferably be named as the corresponding form field names/labels. The names should follow Hungarian notation w/o any space.

3.5         Report output file

The report output file (Excel workbook) should be named as “report_<test script name>”.
The individual sheets in the workbook corresponding to the test cycles should be named as “Test Cycle#<cycle number>”.
E.g. the report file for the test script “TestMaxlengthValidations” should be named as “report_TestMaxlengthValidations”.

4.0         Coding standards

4.1         Commenting

Put descriptive comments at appropriate places to achieve following objectives:
·         A clear understanding of the logic
·         Ease for a person to understand and modify the code

4.2         Indentation

Indent the code appropriately and logically to understand the code flow.

E.g.
For counter = start To end [Step step]
    [statements]
    
   For counter = start To end [Step step]
    [statements]
    [statements]
                Next
   
    [statements]
Next

4.3         Decision statements

The decision statements like “IF”, “CASE” should be coded with following format-
        IF
 
        If condition Then
                               [statements]
               [ElseIf condition-n Then
                               [elseifstatements]] . . .
               [Else
                               [elsestatements]]
    End If

        CASE

        Select Case testexpression
                  [Case expressionlist-n
                     [statements-n]] . . .
                  [Case Else expressionlist-n
                     [elsestatements-n]]
   End Select

4.4         Loops

The loop statements like “WHILE” should be coded with following format-
      Do [{While | Until} condition]
               [statements]
               [Exit Do]
               [statements]
Loop

4.5         Database querying

In a scenario, where database querying is involved, following steps should be followed-

‘Create connection object
Set connectionObject = CreateObject("ADODB.Connection")
‘Create recordset object
Set recordSet = CreateObject("ADODB.Recordset")
‘Connect to the database
connectionObject.Open ("DSN=TEST;UID=<user id>;PWD=<password>;")
‘Fetch records
              While not recordSet.eof
                        tagId = recordSet("ID")
                        DataTable.SetCurrentRow(intRecordSetCounter)
                        recordSet.MoveNext
            .
            .
            .
Wend

Automation Testing Questionnaire

1 What is your requirement/expectation from Functional Testing Automation? 
2 What percentage of the regression suite do you expect to get automated?
3 What is lacking in the present manual testing process you wish to complement/improve through functional testing automation?(highlight business expectation - for regression scenarios, expected business benefits)
4 What is the frequency of change of business rules of the Application (number of change requests/week or month)?
5 What is the frequency of change of UI of the Application (number of change requests/week or month)?
6 Do you have a manual regression test suite? If Yes:
a. What percentage of application functionality does it cover?
b. How many test cases are there?
c. How well described are the cases? Can a tester having no knowledge of your application execute these cases?
d. How long does it take to run 1 full cycle in terms of person days(8 hrs a day)?
e. Where are the test cases stored? (HPQC or equivalent test management tool, Word or Excel)
f. Can you share a sample test case suite with us?
7 How do you set the test environment? 
8 What are the requirements in terms of Hardware and Software? 
9 Where is the application hosted?
10 How will we access the application? (Over the internet, via a VPN connection, Via a citrix connection, installed locally)
11 Technology / Protocol
12 Any data encryption and / or compression while submitting request
13 Describe Application / Product functionality
14 Number of scenarios and/or transactions to be tested
15 No of Modules
16 Scripts per Module
17 No of Scenarios
18 Low Complexity
19 Medium Complexity
20 High Complexity
21 Any interfaces with external applications to be automated? Give details
22 Document upload / download?
23 Similar testing activities done in the past by any vendor, if so, describe problem statement and solution provided
24 Do you already have tools to support this? Do you have a prefered tool and if yes will you provide licenses?
25 Application Server(highlight RAM, service pack, patch etc)
26 Database Server(highlight RAM, service pack, patch etc)
27 Web Server(highlight RAM, service pack, patch etc)
28 Type of Web server
29 Type of Application server & Version (summarize deployment architecture)
30 Type of Database & Version(summarize deployment architecture)
31 Test Environment setup
- Do you have dedicated test environment hosted on separate LAN network
OR
- Is application available in hosted data center 
32 Any specific information to be captured in Test Report
33 Is application hosted on intranet or internet / Cloud? In case of Internet, pl state the network bandwidth

Sunday 16 February 2014

QTP Interview questions



1 When a procedure is created in the Function Library editor, what is the extension on the file? 
A. .INI B. .TXT C. .QFL D. .VBS

 2. What are the categories in the Step Generator?
 A. Object, Operation, Value B. Library, Built-in, Local Script C. Operation, Arguments, Return Value D. Test Objects, Utility Objects, Functions

 3. In Test Settings ->Run the Data Table iteration options are for which data sheet?  A. Local B. Global C. Run-time Data Table D. Design-time Data Table

 4. What can you use to handle unpredictable testing exceptions? 
A. A Do Loop B. Recovery Scenario C. IFHEN statement D. Selectase statement 

 5. In which command can you associate a function library to a test? 
A. Run Options B. Test Settings   C. View Options D. Function Definition Generator 

 6. Where do you set the action iterations for a specified action? 
A. Action Settings B. Action Properties C. Action Run Settings D. Action Call Properties

 7. Where do you mark an action as reusable? 
A. Action Settings B. Action Properties C. Action Run Settings D. Action Call Properties

 8. After running a test that contains both input and output parameters, where can the results of an output parameter be found? 
A. Local DataSheet B. Global DataSheet C. Run-time Data Table D. Design-time Data Table

 9 If you have a Virtual Object Collection stored on your machine, and you don't want to use it, what must you do? 
A. Disable Virtual Objects in Test Settings B. Remove the Collection from your machine C. Disable Virtual Objects in General Options D. Remove the Collections from the Resources list

 10 Which method for the DataTable utility object will allow you to retrieve information from the Data Table during a test run? 
A. Value B. Import C. GetCell D. GetValue

 11 What does the source property of a database checkpoint object represent? 
A. The SQL query B. The identification number of the database C. The number of rows returned from the query D. The connectionstring used to connect to the database

 12. What is created, by default, with each new action?
 A. Local Data Sheet, Global Data Sheet, Folder B. Local Object Repository, Local Data Sheet, Folder C. Global Data Sheet, Local Object Repository, Folder D. Local Data Sheet, Global Data Sheet, Local Object Repository

 13. What are the available environment variable type(s)? 
A. Built-in B. User-defined C. User-function D. Built-in, User-defined E. Built-in, User-function

 14. If the Global Data sheet contains no data and the Local Datasheet contains two rows of data, how many times will the test iterate?

   A. 1 B. 2 C. 3 D. 5  Answer: A

 15. What is the first thing that must be defined in a Recovery Scenario? 
A. Trigger B. Recovery Operation C. Recovery Scenario Name D. The Function used in the scenario

 16. What are bitmap checkpoints sensitive to? 
A. Image size and object type B. Object type and image type C. Screen resolution and object type D. Screen resolution and image size

7. QUESTION 17 If the Local Data sheet contains two rows of data, how many times will the action iterate, by default? 
A. 1 B. 2 C. 3 D. 5

 18. How do you close the database session after examining the results of an SQL query? 
A. Call the ADO.Close function B. Use the close method for the RecordSet object C. Set the RecordSet and Connection objects equal to Nothing D. Use the close method for the RecordSet and Connection objects

 19. What are the available trigger event types? 
A. Pop-up window, object state, VBScript event B. Object State, VBScript event, Application crash C. Pop-up window, object state, test run error, QTP crash D. Pop-up window, object state, test run error, application crash

 20. What is the keyword used to define how the counter variable in a or lext loop increments?  
A. ++ B. Next C. Skip D. Step

 21. What are the two most commonly used ADO objects? 
A. Fields B. Execute C. Connection, RecordSet D. Open, ConnectionString 

22. How do you declare a constant? 
A. Dim statement B. Con statement C. Const statement D. Option Explicit statement

 23. What method is used to retrieve the number of columns in the query results? 
  A. Fields.Count B. Fields.Item(EOF) C. Fields.Count(BOF) D. Fields.Count.Value

 24. To bypass the Object Repository you can: 
A. Turn the Object Repository off B. Use a programmatic description C. Delete all objects in all repositories D. Add the object to the Object Repository Manager

 25. What does the ChildObjects method return? 
A. A Collection object B. A string true/false C. A Boolean TRUE/FALSE D. The number of objects matching the ChildObject description

 QUESTION 26 What object is used to read information from a text file?  A. Read B. ReadLine C. TextStream D. File System E. Open Text File  Answer: C

 27. If you are typing in Expert View and you type an object followed by a dot, what does QuickTest display? 
A. Nothing B. The arguments for that object C. The methods and properties for that object D. The child objects and methods for that object

 28. By default, how does QuickTest pass arguments to the procedure? 
A. ByVal B. ByRef C. ByArg D. ByRes

 29. What object is used to send information to test results at the completion of the test run? 
A. Result B. Reporter C. ReportEvent D. ResultReport

 30. If a procedure is defined in a test script, that procedure is accessible to which tests/scripts? 
A. Only to other procedures B. It is not usable to any test scripts C. The test script in which it is defined D. Using the Step Generator, it is available to any test script

 31. When does a Do loop statement evaluate for continuation? 
A. At the end of the loop B. At the start of the loop C. At the start or the end of the loop D. This loop uses a counter variable

 32. How can you retrieve the number of items in the list for a WebList object? 

  A. GetList B. GetItem C. GetItemsCount D. GetROProperty

 33. What is the difference between a subroutine and a function? 
A. A subroutine can call itself; a function cannot B. A function returns a value; a subroutine cannot C. A function can accept arguments; a subroutine cannot. D. A subroutine can call other procedures; a function cannot.

 34. What method is used to send a run-time Data sheet to an Excel file? 
A. Send B. Export C. SendSheet D. Exportsheet

 35. What looping statements are available in QuickTest? 
A. Whileend, Doloop, Ifhen B. Switchfase, Ifhen, Fortext C. Fortext, Whileend, Doloop D. Fortext, Doloop, Switchase

 36. What does the GetTOProperty method do? 
A. Retrieves the value of a property from a test object B. Retrieves the available properties from a test object C. Retrieves the value of a property from a run-time object D. Retrieves the available properties from a run-time object

37. To use low-level recording, what must you do first? 
A. Start a new test B. Be in the KeyWord view C. Be recording in Normal mode D. Click Low Level Recording under the Automation Menu

38. What is the correct set of add-ins installed automatically with QuickTest 9.2? 
A. NET, Web, Java B. Web, SAP, Visual Basic C. Active X, Visual Basic, Web D. Active X, TE, Web Services

 39. What information can be seen in the information pane? 
A. Syntax errors B. The test name and author C. The QTP license information D. The machine id and operating system

 40. What does a breakpoint do? 
A. Stops test execution at the specified step, after executing that step B. Stops test execution at the specified step, before executing that step C. Pauses test execution at the specified step, after executing that step D. Pauses test execution at the specified step, before executing that step

 41. Which of the following is an example of a missing resource? 
A. An object B. Run Results  C. A Regular Action D. An External

42. What are the available step commands in QuickTest? 
A. Step, Step Into, Step Out B. Step Into, Step Over, Step Out C. Step Test, Step Action, Step Function D. Run from Step, Debug from Step, Run from

 43. When a test is run in update mode, what is updated? 
A. The test results B. The object descriptions C. The action names in the test D. The logical names in the test

 44. What are the phases in the QuickTest workflow? 
A. Plan, Record, Enhance, Run B. Prepare, Record, Verify, Run C. Plan, Create, Verify & Enhance D. Prepare, Create, Verify & Enhance, Integrate

 45. Why is low-level recording mode useful? 
A. It records exact keyboard operations on an object. B. It records exact coordinates of all mouse movements. C. It uses the object repository to determine what methods can be used.

 46. What are test object properties?
A. Those properties as defined in a description object. B. Those properties as defined in Object Identification C. Those properties displayed by an object at run-time D. Those properties used in the Object Repository for object identification 

 47. What is the function of the Object Repository Manager? 
A. Assign variable names to test objects B. View/make/modify a Local Object Repository C. View/make/modify a Shared Object Repository D. Define new test objects using programmatic descriptions

 48. Where are virtual object collections stored? 
A. In a Function Library B. In the local Object Repository C. In the Object Repository Manager D. Dat folder inside of the QTP installation directory

 49. In the Object Identification dialog box, which properties can be viewed? 
A. The base filter and optional properties B. The mandatory and optional properties C. The base filter and assistive properties D. The mandatory and assistive properties

 50. Where do you turn Smart Identification IN? 
A. The Object Repository B. The Test Settings dialog C. The General Options dialog D. The Object Identification dialog

 51. How do you know if Smart Identification has been used in a test? 
A. The Smart Identification icon appears in the test results B. The test results will show a run error, causing a test failure C. The properties used by the object repository will be changed D. The Object Repository will show the Smart Identification icon

 52. What options are available to filter objects in the Target Object Repository pane when merging object repositories? 
A. Show all objects or Show only objects with conflicting object types B. Show all objects or Show only objects with conflicting descriptions C. Show only objects with conflicting logical names or Show only objects with conflicting object types D. Show only objects with conflicting logical names or Show only objects with conflicting descriptions

 QUESTION 53 What is the default ordinal identifier?  A. The location B. The object id C. The nativeclass D. The index number  Answer: A

 54. Which statement is used to associate a procedure with a test object class? 
A. RegisterFunction B. RegisterUserProc C. RegisterUserFunc D. RegisterProcedure

 55. What must you do before a shared object repository can be edited? 
A. Enable Editing B. Add a new object C. Open the object repository D. Open an action that uses that shared object repository

 56. Where do you configure an action to use a shared object repository? 
A. Test Settings B. Action Settings C. Action Call Properties D. Associate Repositories

 57. You should use local object repositories when you: 
A. Work with single-action tests B. Work with multiple-action tests C. Create multiple tests for a single application D. Expect the test object properties to change frequently

 58. Where can you merge two shared object repositories? 
A. The Object Repository B. The Object Repository Manager C. The Associate Object Repositories Tool D. You can only merge local object repositories




Saturday 15 February 2014

HP UFT 11.5 tool new features


1. HP UFT Overview


The latest version of HP-QTP that is going to hit the market will be known as HP Unified Functional Testing(UFT) 11.5 .

QuickTest Pro (QTP) (GUI Testing Feature)+ Service Test (ST) (API Testing Feature) = Unified Functional Testing (UFT)


This is going to be a major change on how we see QTP. Going forward, QTP and Service Test will be a part of UFT 11.5 software. Acc. to HP, this has been done to serve end to end testing needs. QTP(GUI testing tool) and Service Test(API testing tool) will be available from a single interface, so you need not download two separate tools from now on.

2. Newly added Action features in UFT


  • Separate action flows
  • Individual data sources
  • Independent input/output parameters

3. Insight Recording

HP UFT Insight breaks down barriers with innovative image-based object recognition, which allows the testing software to recognize and record any application, irrespective of the tool used to build it.
With Image-based object identification you can now learn an object’s (or images) different states and convert that into a recognizable object within the object library.

4. Supports Mobile Testing

Realizing the ‘explosive’ growth of mobile (smart-phones + tablets) platform, HP is putting a lot of focus on this new age tech. UFT 11.5 will provide a better support for mobile testing. With the help of HP UFT Mobile, HP claims that you will be able to create mobile platform agnostic scripts, hence a script created for iOS would be expected to work for Android. The mobile application testing solution will support emulators as well as real devices. The real devices can be sourced from the public cloud of shared real devices and/or private cloud of dedicated real devices.

5. ALM Data for UFT


ALM’s Data Awareness feature enables us to
  • Save multiple relevant sets of data in our ALM project
  • To run A Test with different data configurations, enabling more realistic and data-drive tests of our application

6. API Testing

This is really great feature in this UFT 11.5 tool. where we can test APIs

7. Enhanced Bitmap checkpoint


Validate an image by comparing it to an existing bitmap

8. BPT (Business Process Testing ) with UFT

Now with UFT we can do Business Process Testing without integrating with HP ALM/QC.

9. Enhanced scripting feature with Dot Object


There is a new feature added in Dot Object. We can Set/Get values with child Dot Object methods

10. File content checkpoint


Before UFT 11.5 we used face lot of difficulties to read data from different external files. Now with File content checkpoint we can read the data from different files ex: PDF,HTML, RFT, txt, doc, etc: easily.

11. Loading Function Libraries from HP ALM with LoadFunctionLibrary Method


We can load function library files which are stored in HP ALM during run time.

12. New way to Describe object in UFT


Please see below screen shot for the new way to describe object in UFT.

13. Array Checkpoint


Array checkpoint gives 3 different options to verify the content in array.
  • Fixed
  • Contains
  • All

14. Update in WSDL

If there is any change in WSDL file, we no need to create a new test for that now. UFT has option to update services directly and map arguments.

15. Multiple script Debugging

This was a much needed and requested feature. You will now be able to debug two or more scripts at the same time from within UFT’s IDE.
On top of QTP current debugging capabilities which are limited, but Using this new feature of UFT 11.5 We can able to debug the two or more automation scripts at same time using the UFT 11.5 IDE.

Following panes are greatly added to the HP UFT list of debug features:
The following panes have been added and enhanced:
  • Call Stack – allows you to view info about the methods and functions that are currently in the call stack.
  • Loaded Modules – for API tests, this pane allows you to view info on .dlls that are loaded and executed in API test runs.
  • Threads – For API tests–allows you to view info about threads currently running as part of the run session.
  • Local Variables Pane – allows you to view all the current values and types of variables in their current context.
  • Console Pane – when debugging a script, this pane allows you to run lines of VBScript (for GUI tests) and C# code (for API tests) in your suspended run session.
  • Watch – when debugging, this pane allows you to view the current values ad types of selected variables, properties, and VBScript of C# expressions in a test’s suspended run session.
  • Debug pane – enables you to view the current values and types of variables, properties, and VBScript or C# in a test’s suspended run session.

16. Smart Regular Expressions


There is a new feature added in UFT where we can add regular expression smartly with lot of available options.

17. REST Service


We can load REST service and test it as same as WebService.

18. Share Activities in UFT


Now we can share activities across UFT
  • Sharing it to local (File System)
  • Sharing it to ALM

19. UFT Solutions


Solutions bring together all types of testing documents in to a unified container to organize testing sessions

Ex: you can combine GUI and API tests and components and BPT tests in to one solution


Actions, QTP Tests, Application Areas, API Tests.. etc. have been added in above Solution

20. Run step feature for API tests

For Service Test API test users, this feature is a simple change but an absolutely killer enhancement that’s going to save me a lot of time–the ability to run any step on the canvas areas using the new “Run step” command.

If you have an API test made up of 50 operations, you’ll no longer need to run the whole test from the top. Simply right click on any operation on the Canvas. For instance, selecting “Run step” will run only that operation. Sweet!

21. Supports Open Source CI Systems

HP UFT 11.5 will support open source Continuous Integration(CI) systems like Jenkins and Hudson. For people with non-development background - CI is a practice normally used in a multi-developer environment where all developer codebases are merged with the main codebase several times a day

Downloading UFT 11.5 tool

HP ALM 11.5 is already available now. You can download ALM 11.5 using this link

http://www8.hp.com/us/en/software-solutions/software.html?compURI=1172122#tab=TAB3