Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Tuesday, 23 May 2017

Basic Automation Testing Questions and Answers

1) What is Automation?
General definition: Manual Process to mechanized process
Software Industry definition: Automation is a Microsoft technology that makes it possible to access software objects inside one application from other applications. These objects can be created and manipulated using a scripting or programming language such as VBScript or VC++. Automation enables you to control the functionality of an application programmatically.
2) What is Test Automation?
Automating Software Test process using Test Tools
3) What is Test Tool?
Test tool is software application it performs test operations based on user instructions.
4) What are the disadvantages of Manual Testing?
i) Huge Amount of Human Resources as well as Environment (Test lab)
ii) Time taking process
iii) Less Accuracy
iv) Tiredness
5) What are the advantages of Test Automation?
i) Fast: Tools are faster in execution than human users
ii) Reliable: Tools are reliable in complex calculations and tasks
iii) Reusable: we can reuse Automated Tests on multiple versions of Software (Ex: Sanity Tests, Regression Tests)
iv) Repeatable: we can repeat same operations with multiple sets of Test Data (Ex: Data driven Tests)
v) Programmable: we can use flow control statements for applying logic (Scope of Automated Tests is very high than Manual Test Cases)
vi) Comprehensive: we can execute series of Tests without human interaction (Ex: Batch Testing)
6) What are the drawbacks of Test Automation?
i) Test design requires lot of efforts
ii) 100% test automation impractical
iii) All types of testing not possible (Ex: Usability)
iv) Debugging issues
v) Tools may have their own defects
7) What is Vendor tool and give examples?
Companies develop tools, license is required to use and get technical support.
HP-WinRunner, QTP, LR, QC
IBM-Rational- Rational Robot, RFT, RPT, QA Director
Micro-SilkTest, Silk Performer
8) What is Open source Tool and give example?
Source code available on Internet anybody can download and use.
Ex: Selenium, Jmeter, Bugzilla, QAwebload etc…
9) What is In-house tool?
Some companies develop tools for their internal use.
Microsoft, Oracle Corporation and IBM developed so many tools for their internal use.
10) Give some examples for Functional & Regression Test Tools?
HP- QuickTest Professional (QTP)
IBM- Rational Functional Tester (RFT)
Micro Focus- Silk Test
Test Complete
Test Partner
Selenium (Open Source)
11) Give some examples for Performance Test Tools?
HP-LoadRunner
IBM-Rational Performance Tester (RPT)
Micro Focus- Silk Performer
JMeter (Open Source)
Etc..
12) Give some examples for Test management Tools?
HP- Quality Center / ALM
Jira
Rational QA Director
Etc..
13) Give some examples for Defect Management Tools?
Bugzilla,
Issue-Tracker,
PR-Tracker
Etc…
14) What is the deference between Automation tools and Management tools?
Automation tools interact with software applications, Test management tools don’t interact with software applications.
Test management tools only for documentation and generation reports where as Automation tools execute our software applications.
15)What is Functional Testing?
Testing based on an analysis of the specification of the functionality of a component or system.
16) What is Regression Testing?
Testing of a previously tested program following modification to ensure that defects have not been introduced or uncovered in unchanged areas of the software, as a result of the changes made. It is performed when the software or its environment is changed.
17) What are different coverages in Function Testing?
Verifying the Functionality (external behavior) of a component or System
i) Input Domain Coverage
Verifying weather the system is accepting valid inputs or not? And preventing invalid inputs or not
ii) Output Domain Coverage
Verifying weather the System is providing correct Outputs or not, based on input and process
iii) Database Testing
Verifying the data validations, data storage and data retrieval operations
iv) Error handling
Verifying how the system is handling user unathurized/invalid operations and providing error and help messages.
v) Order of functionalities
Verifying weather the System is providing correct order of functionalities or not
18) What are the important operations in Database Testing?
Data Integrity,
Data Manipulations,
Data Comparisons,
Data Retrieval,
Data back-up and recovery operations etc…
19) What is Functional and Regression Testing?
20) Who uses QTP Tool?
HP- QuickTest Professional is an Industry leading Functional & Regression Test tool and it supports advanced keyword driven test approach.
Automatio Testers and End users use QTP Tool
21) What type of Scenarios can be automated?Tests that we have to execute on every build (Sanity Tests)
Tests that we have to execute on every modified build (Regression Tests)
Tests that we have to execute with multiple sets of test data (Data driven Tests)
22) What type of Scenarios can’t be automated?
Tests that require human user observation
Tests that requires one time execution



23) How to perform Cross platform testing and Cross browser testing using QTP? Can u explain giving some example?
You will need to create separate Actions which take care of different OS and Browsers
Cross Platform Testing:

Using the Built in Environment Variable you can dig up the OS information.

Eg. Platform = Environment("OS"). Then based on the Platform you need to call the actions which you recorded on that particular platform.

Cross Browser Testing:

Using this code  Eg. Browser("Core Values").GetROProperty("version") you can extract the Browser and its correspondin version. Ex: Internet Explorer 6 or Netscape 5. Based on this value you call the actions which are relevant to that browser.
24)Can we record an application running on a remote machine using QTP ?
Yes .you can record remote application provided you are accessing application through the local browser not via remoter like citrix.
If you are still unable to record it is advisable install QTP and application, on the same machine
25) Explain the keyword CreateObject with an example.
Creates and returns a reference to an Automation object
SYNTAX: CreateObject(servername.typename [, location])
Arguments
servername: Required. The name of the application providing the object.
typename :  Required. The type or class of the object to create.
location :  Optional. The name of the network server where the object is to be created.
Example : Set IE = CreateObject("InternetExplorer.Application")
26) Can you switch between Per-Action and Shared Object Repository ? If yes how ?
Yes .We can switch. Go to Test--->Settings--->Resources. Here  you have an option to choose repositories. 
27) When ordinal identifiers alone can make an object unique then why they are not given top priority? Why it is first mandatory and next assistive. Why we cannot go for ordinal identifiers directly?
Consider the following -
a) If two objects are overlapped on each other than location based object recognition will fail.
b) If only index based recognition is used your script will work but script execution time will increase.

Hence mandatory and assistive properties are used.
28) What is Step Generator?
Step Generator enables use to Add Test Steps in your script. Using step generator you can add steps to your script without actually recording it.
29) How to make QTP understand the difference amongst the  same type of objects .Suppose there are 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?
You can use ordinal identifiers like index along with a little descriptive programming for object recognition.
Watch a video of this example.
30) What is Test Fusion Report ?.
Test Fusion Report , displays all aspects of a test run and is organized in a Tree format.
It gives details of each step executed for all iterations.
It also gives Run-time data table, Screen shots and movie of the test run if opted.
31) How can you handle exceptions in QTP?
In QTP Exceptional handling is done by using
a. Recovery Scenarios.
b. Using “On Error” statement
In Recovery scenario you have to define.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
At Script Level you can use the On Error Resume Next and On Error Go to 0 statement.
32) What is a Run-Time Data Table? Where can I find and view this table?
Data like parameterized output , checkpoint values , output values  are stored in the Run-time Table. It is an xls file which is stored in the Test Results Folder.  It can also be accessed in the Test Fusion Report.
33) What is the standard timing delay for web based application in QTP ?
The standard delay is 60 seconds. This is can be changed in Test Settigns.
34) What are the ways in UFT to get system environment variables in UFT?
There are three ways to get system environment variables in UFT
Use the WSH shell object
  • Use WMI’s Win32_Environment Class
  • Read variables from the registry
Set myShell = CreateObject (“WScript.Shell”)

WScript.Echo myShell.ExpandEnvironmentStrings( "%PATHEXT%" )

myShell=Nothing,
The output will be .BAT;.CMD;.VBS;. VBE;. JS;. JSE
Other user variable, like TEMP, overwrite their system counterpart
Set myShell = CreateObject( "WScript.Shell" )

WScript.Echo myShell.ExpandEnvironmentStrings( "TEMP=%TEMP%" )

myShell=Nothing
The output will be TEMP:C:\DOCUME~1\You\LOCALS~1\Temp
35) In UFT how you can prevent the system from getting locked?
To prevent system getting locked, any of the two ways can be used
  • Create a simple vbs file having code to press numlock key and run that vbs file
  • Edit one registry key “DisableLockWorkstation =1” to disable locking
36) Give the syntax to import/export xls into QTP.
 DataTable.ImportSheet "..\..\TestData\Input.xls",1,dtGlobalSheet

DataTable.ExportSheet "..\..\Results\Output.xls","Global"
37) Explain how you can fetch data from database in UFT?
Set db= createobject (“ADODB.Connection”)
db.Open 
“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Raju\vb6\admission_project.mdb;
Persist Security Info= False

Set rst=createobject(“ADODB.Recordset”)
rst.Open “select*from Course”, db, 3
id=rst. RecordCount

For i=0 to id-1
Print rst.field (0) & rst.fields (1) & rst.fields (2) & rst.fields (3)
rst.Movenext
Next
38) Explain in what ways we can export datatable to excel in UFT?
To export data-table to excel, there are two methods.
a)      DataTable.Export (“C:\export.xls”)
b)      DataTable.ExportSheet “C:\mysheet.xls”   ( If excel file does not exist, new file is created)
39) In datatable sheet in UFT, how to read a value from the cell?
To read a value from the cell, we follow 2 step process
a)      We set the row pointer in first step
b)      In second step we define the parameter/column name from the sheet to read
Example:
For this example, we have set the row pointer to 2 in transaction sheet
Datatable.GetSheet(“Transactions”).SetCurrentRow(2)
Now, we have to specify that we want to read a value from the module_name column from the transaction sheet
   Print datatable.Value (“Module_Name, “Transactions”)
40) What are the types of error need to be handle in UFT?
There are three types of error that one will face in UFT
a)      Syntax Errors
b)      Logical Errors
c)       Runtime Errors
41) What are the ways you can handle run time errors?
There are various ways to handle run time errors
a) Using test settings
b) Using on error statement
c) Using err Object
d) Using Exit Statement
e) Recovery Scenarios
f)  Report Object
42) How to add synchronisation points in QTP?
There are 4 ways through which we can add synchronisation points in QTP
a) Wait statement :  This statement will pause the execution for x seconds until object comes up
b) Wait property : This method will wait until property of object takes particular value
c) Exist statement : This statement will wait until object becomes available
d) Sync method: The code will wait until browser page is completely loaded. For web application testing this method is used.
43) In QTP explain what is crypt object
Crypt object in QTP is used to encrypt a strings.
Syntax
Crypt.Encrypt(“Razu”)
Example :
In this example, value in pwd variable is encrypted using the Crypt. Encrypt method.
Then this encrypted value is entered into editbox.
 pwd= “myvalue”
pwd = Crypt.Encrypt (pwd)
Browser(“myb”).WinEdit (“pwd”). SetSecure pwd
44) How to define array in QTP?
Array can be defined in 3 ways in QTP
a) Fixed size array in QTP
Dim A (10) - single dimension
Dim MyTable (5,10) – multi-dimension

b) Dynamic array-size not fixed
Dim MyArray()ReDim MyArray(25)

c) Using Array Function in QTP
A= Array (10, 20,30)
B= A(2) ‘ B is now 30
45) When ‘option explicit’ keyword is used in QTP?
To specify that all variable must be declared before use in QTP,  ‘Option Explicit’ keyword is used.
46) In QTP how you can exit for loop?
You must use “Exit For” statement to exit “for loop” in QTP. “Exit For” statement will get the control out of the “for loop”
For count= 1 to 3
      TempNum= mid(Tempstr,count,1)
      If isnumeric(TempNum) Then
          LenghtNum = LengthNum & TempNum
      Else
      Exit For
      End If
Next
GetStrLenNumber = LengthNum
47) What is the significance of “action 0” in QTP?
“Action 0” is created by default when you create a new test in QTP along with action 1.  To determine the sequence in which we call other actions 1,2,3 etc. action 0 is used.
48) How you can check if parameter exists in Datatable?
To check whether if parameter exists in data table we will use the code
on error resume next
val=DataTable(“ParamName”, dtGlobalSheet)
if err.number<>0 then
     ‘Parameter does not exist’
else
      ‘Parameter exists
end if
49) In QTP how you can use Xpath to identify objects?
Xpath can be used to identify only web objects. We can use the following code to identify objects.
Set oPage=Browser(“myGoogle”).Page(“myGoogle”)
oPage.WebEdit(“xpath:=//INPUT[@name=‘nameofeditbox’]”).Set “search term”
‘Enter value in google edit box
50) Explain how you can delete excel file in QTP? 
To delete excel file in QTP, 
Set fo = createobject(“Scripting.filesystemobject”)
fo.deletefile(“C:\xyz.xlsx”)
Set fo=nothing