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.

Friday, 18 December 2015

Exist Stament In Vb-Script

Exits a procedure or block and transfers control immediately to the statement following the procedure call or the block definition.

Statements

Exit Do: Immediately exits the Do loop in which it appears. Execution continues with the statement following the Loop statement. Exit Do can be used only inside a Do loop. When used within nested Do loops, Exit Do exits the innermost loop and transfers control to the next higher level of nesting.

Exit For: Immediately exits the For loop in which it appears. Execution continues with the statement following the Next statement. Exit For can be used only inside a For...Next or For Each...Next loop. When used within nested For loops, Exit For exits the innermost loop and transfers control to the next higher level of nesting.

Exit Function: Immediately exits the Function procedure in which it appears. Execution continues with the statement following the statement that called the Function procedure. Exit Function can be used only inside a Function procedure.To specify a return value, you can assign the value to the function name on a line before the Exit Function statement. To assign the return value and exit the function in one statement, you can instead use the Return Statement (Visual Basic).

Exit Property: Immediately exits the Property procedure in which it appears. Execution continues with the statement that called the Property procedure, that is, with the statement requesting or setting the property's value. Exit Property can be used only inside a property's Get or Set procedure.
To specify a return value in a Get procedure, you can assign the value to the function name on a line before the Exit Property statement. To assign the return value and exit the Get procedure in one statement, you can instead use the Return statement. In a Set procedure, the Exit Property statement is equivalent to the Return statement.

Exit Select: Immediately exits the Select Case block in which it appears. Execution continues with the statement following the End Select statement. Exit Select can be used only inside a Select Case statement.

Exit Sub: Immediately exits the Sub procedure in which it appears. Execution continues with the statement following the statement that called the Subprocedure. Exit Sub can be used only inside a Sub procedure.
In a Sub procedure, the Exit Sub statement is equivalent to the Return statement.

Exit Try: Immediately exits the Try or Catch block in which it appears. Execution continues with the Finally block if there is one, or with the statement following the End Try statement otherwise. Exit Try can be used only inside a Try or Catch block, and not inside a Finally block.

Exit While: Immediately exits the While loop in which it appears. Execution continues with the statement following the End While statement. Exit Whilecan be used only inside a While loop. When used within nested While loops, Exit While transfers control to the loop that is one nested level above the loop where Exit While occurs.

Note: Do not confuse Exit statements with End statements. Exit does not define the end of a statement.

Friday, 4 December 2015

Methods for Browser Object

Following are methods for Browser object:

OpenNewTab:-Opens a new tab in the existing opened browser window. 
Ex:Browser("CreationTime:=0").OpenNewTab()


Activate Browser:  using this method we can activate browser.
ExBrowser("title:=Google.*").Activate

Minimize Browser: using this we can minimize browser.
EX: Window("name:=Seessionwindow").Minimize

Maximize Browser: using this method we can maximize browser.
Ex: Window("name:=sessionwindow").Maximize

Navigate:-Redirects to given URL.

EX: Browser("CreationTime:=1").Navigate "www.Google.com"

FullScreen:-Open the browser in Full-screen mode(F11).

Ex: Browser("CreationTime:=0").FullScreen

Refresh:-Refresh the opened page(Like F5).

Ex:Browser("CreationTime:=0").Refresh

DeleteCookies:-For deleting the cookies from the browser.

Ex: Browser("CreationTime:=0").DeleteCookies

CloseAllTabs:-Close all the opened tab and also the browser instance.

Ex: Browser("CreationTime:=0").CloseAllTabs()

Sync:-Wait for the browser for navigating to the opened URL Application.

Ex:Browser("CreationTime:=0").Sync

NOTE: Browser does not support the ActivateMinimizeMaximize methods

Example:


'Open a new Browser using Util Object
SystemUtil.Run "iexplore.exe", "www.uft.com"

'Browser Sync
Browser("CreationTime:=0").Sync

'Delete cookies from the Browser
Browser("CreationTime:=0").DeleteCookies

'Refreshes the Opened Page
Browser("CreationTime:=0").Refresh

'Opening  a new tab within the same browser
Browser("CreationTime:=0").OpenNewTab()

'Opening Browser in FullScreen mode
Browser("CreationTime:=0").FullScreen

'Sync for new tab
Browser("CreationTime:=1").Sync

'Navigate to perticular URL in the new tab
Browser("CreationTime:=1").Navigate "www.Google.com"

'Find total number of tabs in the browser window
iTabs = Browser("CreationTime:=0").GetROProperty("number of tabs")
msgbox iTabs 'Displays the value 2

'Close all the tabs in the browser window
Browser("CreationTime:=0").CloseAllTabs()


Sunday, 1 November 2015

Objects in UFT

Basically UFT is object based Test Tool, Based on the front end objects only it performs Test Operations.

Object: It is something which has structure and properties.

Property: It is an attribute of the Object, which describes the object.

Method: It is an operation on the Object.

Note: For database testing no object reference is required, uft has an integrated SQL engine, we can execute SQl commands directly in the UFT Tool Editor.

Software Objects in Windows based Environment:
Window, dialog box, Button, Radio Button check box, Edit box, List box, Drop-down box, Combo box etc….

Software Objects in Web based Environment:
Browser, Page, Link, Image, Button, Radio Button, Check box, Edit box, List box, Drop-down box, Combo box, etc….

Types of Objects in UFT:



1. Run-time Objects
2. Test Objects
3. Utility Objects
4. Automation Objects

1. Run-time Objects: 

Objects Present in the Application.
Ex: Buttons, Links, Edit boxes etc…

Note: Irrespective of the environment (Ex: Java or .NET or Web)end user calls Button is button, Checkbox is checkbox,  Edit box is Edit box (If it is Java , .NET or any environment).

States of Run time objects:
Enabled, Disabled, Visible, Hidden, And Focused.

2. Test Objects: 

Reference of Run time objects are called test object.
Test object name varies from one environment to another

Example:
-----------------------------------------------------------------------------------
Object                  Windows                         Visual Basic                   Web
-----------------------------------------------------------------------------------
Button                  WinButton                      VbButton                     WebButton
Edit box                WinEdit                           VbEdit                         WebEdit
Browser                  NA                                    NA                          Browser
Page                       NA                                    NA                          Page
-----------------------------------------------------------------------------------

How to Get Test Object Information

1. Using Object Spy
2. Using Object Identification

States Of Test Objects

Constant Object:  Whose Properties values are fixed

Dynamic Object:    Whose Properties values change dynamically throughout the execution.

Duplicate Objects:  Two are more objects with same description.

3.Utility Objects

They are UFT Reserved Objects used for Testing and Result Reporting.
Every Utility object is unique.

Example:
Systemutil Object is used to launch the Application.

Syntax:
Systemutil.Run “Path of the Application”,    [Windows based application]
Systemutil.Run “Path of the Browser”,”url”    [Web based Application]

4.Automation Objects:

They are User defined Objects used to work with Drives, Folders, Databases and Files.

a.File System Object Model

It is used to work with Drives, Folders and Files (Flat files)


Class value: ("Scripting.FileSystemObject")


How to create File System Object?


Set Variable = CreateObject(“Scripting.FileSystemObject”)


b.Excel Application Object

It is used to work with Excel Application/Excel files


Class value: ("Excel.Application")


c.Word Application Object

It is used to work with Word Application / Word documents


Class Value: ("Word.Application")


d.Database Objects

1.Database Connection Object


It is used to connect to Databases


Class value: ("Adodb.Connection")


2.Database Recordset object


It is used to perform operations on Database Tables


Class value: ("Adodb.Recordset")


e.Dictionary Object

It is used to define Key, Value pairs


Class value: ("Scripting.Dictionary")


f.QTP Application Object

It is used to automate UFT Tool operations and it is Local object model


Class Value: ("QuickTest.Application")


Monday, 19 October 2015

What is ISTQB

The International Software Testing Qualifications Board (ISTQB) is a software testing qualification certification organisation that operates internationally. Founded in Edinburgh in November 2002, ISTQB is a non-profit association legally registered in Belgium.
ISTQB Certified Tester is a standardized qualification for software testers and the certification is offered by the ISTQB. The qualifications are based on a syllabus, and there is a hierarchy of qualifications and guidelines for accreditation and examination. The ISTQB is a software testing qualification certification organization having over 350,000 certifications issued; the ISTQB® consists of 49 member boards worldwide representing 72 countries (date: June 2014).
Currently ISTQB® provides three levels of certification:
1.ISTQB Fundation level
2.ISTQB Advance Level 
3.ISTQB Expert Level

Note: More Details Click Here


ISTQB

Friday, 16 October 2015

QTP/UFT vs Selenium vs Selenium (Webdriver)

1. Licence type
QTP/UFT - Commercial software (Concurrent and per user licence)
Selenium - Open source.
Webdriver - Open source.
2. Software size
QTP/UFT - Around 1.5GB
Selenium - Set of Libraries, around 20MB (Need to include other supporting software)
Webdriver - Set of Libraries, around 20MB (Need to include other supporting software)
3. Software Support
QTP/UFT - From HP
Selenium - 
Saucelabs.comElement34 , Commercial Support
Webdriver - Same as Selenium
4. Identifying objects.
QTP/UFT -  Object properties, Repository objects
Selenium - Html ID, xPath, CSS, DOM, Link text
Webdriver - Html ID, xPath, CSS, DOM, Partial Link text, Class Name
5. Spying object
QTP/UFT - GUI Spy/API Spy
Selenium - There is no option, can record script in Selenium IDE, can spy objects using IE developer tool bar, FireBug and also using 
http://saucelabs.com/builder
Webdriver - Same as Selenium, there is no option of recording the scripts. With the introduction of built in developer tool bar from IE8 made thing easy for IE.
6. Scripting language
QTP/UFT - VB Script, C#(UFT API tests)
Selenium - Any language HTTP library (Java, C#, Python, Ruby...)
Webdriver - Java, .Net, Python, Ruby, Node JS
7. Environment.
QTP /UFT- Windows, MacOs
Selenium - Windows, OS X, Linux, Solaris.
Webdriver - Windows, Mac, Linux, iOS, Android
8. Browsers supported
QTP/UFT - IE, Firefox (Run scripts),safari,Chrome
Selenium - IE, Firefox, Safari, Opera
WebDriver - IE, Firefox, Safari, Opera, Chrome, Android, iPhone

11. Identifying objects
QTP/UFT - Browser.Page.Object.Method for each step.
Selenium - Directly execute methods, no browser page reference required.
WebDriver - Directly execute methods, no browser page reference required.

12. Debugging code (Setting breakpoints in the code)
QTP/UFT - Yes
Selenium - No (Need to read logs and understand the error)
Webdriver - No (Write wrapper around webdriver listener to read logs, from 2.15 it is automatically generating logs)

13. Control Opened browsers (Attach to running browsers)
QTP/UFT - Yes (Opened after QTP program)
Selenium - No (Session information is lost) .
Webdriver - No (Fix in Progress)

14. Supporting Applications
QTP - Web applications, SAP, Activex, VB, Windows...(Support provided using Addins)
Selenium - Only Web application.
Webdriver - Only Web application.

15. As performance testing tool
QTP/UFT - No, you can run one QTP application in one CPU.
Selenium - It can open many many browsers using GRID, many companies line PushToTest, BrowserMob, Gomez use selenium technology for running load test.
Webdriver - Same as Selenium, now we have GRID2.

16. Current Version
QTP/UFT – 12.5(
July 2015)
Selenium - 2.0
Webdriver - 2.48

17. Object not found timeout
QTP/UFT - It will wait till the timeout happen.
Selenium - If browser status is Done, it will through exception. In some cases it will wait for time out.
Webdriver - Same as Selenium, It has implicit and explicit timeouts.

18. Execute JavaScript
QTP/UFT - Yes
Selenium - Yes
Webdriver - Yes

19. Access page DOM
QTP/UFT - Yes
Selenium - Yes
Webdriver - Yes

20. Flex objects
QTP/UFT - Yes
Selenium - Yes  Selenium Flex
Webdriver - Yes  Selenium Flex

21. Scripting complexity
QTP/UFT - Simple, but implementing framework is complex.
Selenium -Simple, but implementing framework is complex.
Webdriver - Simple, but implementing page objects is slightly complex.

22. Cost
QTP - 9K USD per user (Approx) + Annual maintenance charges.
Selenium - FREE (Any number of users...)
Webdriver - FREE (Any number of users...)

23. IDE
QTP/UFT - Own IDE
Selenium - Any IDE (I prefer Eclipse)
Webdriver - Any IDE (I prefer Eclipse)

24. Flavors
QTP/UFT – QTP/UFT with different Add-in's


Selenium - Selenium core, Selenium IDE, Selenium RC, Selenium GRID.
Webdriver - Webdriver, GRID2.

25. Extendability
QTP/UFT - No
Selenium - Yes, you can customize and implement for new browsers.
Webdriver - Same as Selenium.

26. Exception Handling
QTP/UFT - Need to handle manually. Using .Exist, On error resume next, recovery scenarios. Script would stop in the middle by throwing run-time error if not handled properly. Programmer should have complete understanding where to use exception handling, else he suppress real errors.
Selenium - Handled automatically when used with TestNG, it will automatically move to next test case and user can implement Try...Catch to handle specific exceptions.
Webdriver - Same as Selenium. It has some extra exceptions like NoElementFound where code can be handled in a better way.

27. Reporting and Assertions(Checkpoints)
QTP/UFT - Reporting and checkpoints are built in the same package.
Selenium - Need to depend on testing frameworks like TestNG or Junit.
Webdriver - Same as Selenium.

28. Recording the script
QTP/UFT - Built in recorder that can generate script on IE.
Selenium - Selenium IDE as Firefox add on.
Webdriver - No

29. Script Execution
QTP/UFT - Just hit Run button.
Selenium - Need to run Selenium Server and it opens a separate window apart from the browser.
Webdriver - Just hit play button.

30. Page synchronization
QTP/UFT - Use .Sync method  to check the page load for every page navigation.
Selenium - Use Wait for page load. 
Webdriver - It is handle automatically, no method is required. 
 31. Handle AJAX calls
QTP/UFT - Manual
Selenium - Manual
Webdriber - Manual

32. XPath Support (Awesome technique to locate elements when there is no id or name)
QTP/UFT - Yes
Selenium - Yes (Very slow on IE)
Webdriver - Yes

33. Accessing windows objects (Folders, Excel, Notepad)
QTP/UFT - Easy (As it is developed in VB script native windows script. I hope this is one of the reason why qtp selected VB Script)
Selenium - Not so easy, need to depend on open APIs.
Webdriver - Same as selenium.

34. Code base
QTP/UFT - Huge, storing Actions occupy lot of space and more number of files. I prefer creating code in function libraries only (.vbs, .txt, .qfl)
Selenium - Small, text file with .java extension. Suitable with any configuration management tools.
Webdriver - Same as selenium.

35. Executing test on different systems
QTP/UFT - Need to setup QTP/UFT and copy the code execute it.
Selenium - Using ANT it is possible to compile into standalone jar file, so that it is easily executed from the command prompt.
Webdriver - Same as selenium.

36. APIs
QTP/UFT - Each object has methods and properties. QTP classified the objects into (WebEdit[Textbox], WebButton, WebList, WebRadio Button....). Objects are classified into Windows, Web, People soft, SAP, Visual Basic, Activex...., need to add extra licensed programs called Addin for supporting of the corresponding objects. Addin program can help QTP/UFT to identify the properties in specific environment. To identify an object on the screen, need to provide properties. Properties are classified into Mandate, Assistive and ordinal properties.

Selenium - Directory based API, all methods exist in one class. It is a table based API that contain 3 columns
Note: Browser, Page details are not required; its reference is automatically handled by Selenium session.
Webdriver - Complete OOPs.

37. Number of Methods
QTP/UFT - Each object has certain methods, most of the methods are unique like Set, Click, Select...
Selenium - Few methods.
Webdriver - You can complete most of the script using click and SendKeys.

38. Object Repository (Object information is stored separately during recording and can be edited if required)

QTP/UFT - Yes. Also provide option to define objects at code level called descriptive programming (DP).
Selenium - NO, only through code.
Webdriver - NO, only through code.

39. Page Objects Implementation
QTP/UFT - VB script don't supports complete OOPs, but can be achieved with Dual-Function Framework.
Selenium- I think no, it is not possible to move Selenium session from one class to another, but methods can be grouped as per the page by extending the Selenium interface.
Webdriver - Yes, support complete OOPs. (Planning to write a new post on this with an example).

40. Synthesizing events on the page
QTP/UFT - Synthesize events on DOM.
Selenium - Synthesize events on DOM.
Webdriver - Type looks very realistic as though real user is typing. I think they are sending the events to IE instance message queue. (Need to understand the technique used)
Over all comparison:
QTP -
Browsers - (IE/Firefox)
OS - (Windows)
Scripting - (VB Script)
Licence - ($8000 per user)

Webdriver -
Browsers - (IE, Firefox, Safari, Opera, Chrome, Android, iPhone),
OS - (Windows, Mac, Linux, iOS, Android)
Scripting - (Java, .Net, Python, Ruby, Node JS)
Licence - Free


VBS WebDriver

Selenium web driver supports a wide variety of client drivers implemented in different languages,but it does not support Vb script client drivers which is playing a key role in QTP/UFT automation. UFT and Selenium are the two widely used functional automation tools which are always different(in terms of licensing ,the languages they support for scripting). But now "VBS Webdriver" is an api used to implement selenium web driver using VB script(Now This is common for UFT & Selenium:)). Now one can automate their application using selenium ,choosing vbscript as their scripting language.

NOTE: For more details Click Here

Thursday, 15 October 2015

General UFT Interview Questions

1) You have some new releases and bug fixes in working module. So how will you ensure that the new bug fixes have not introduced any new bug in previous working functionality?
You need to test the previous functionality also. So will you test manually all the module functionality every time you have some bug fixes or new functionality addition? Well you might do it manually but then you are not doing testing effectively. Effective in terms of company cost, resources, Time etc. Here comes need of Automation.

– So automate your testing procedure when you have lot of regression work.
2) You are testing a web application where there might be thousands of users interacting with your application simultaneously. How will you test such a web application? How will you create those many users manually and simultaneously? Well very difficult task if done manually.
– Automate your load testing work for creating virtual users to check load capacity of your application.
3) You are testing application where code is changing frequently. You have almost same GUI but functional changes are more so testing rework is more.
– Automate your testing work when your GUI is almost frozen but you have lot of frequently functional changes.


Thursday, 8 October 2015

Can we use GetRoProperty method to get index or location of link in web application??

Answer : Yes



What is the difference between Repository Parameter and Repositories Collection ??

Repository parameters are enable you to specify that certain property values should be parameterized, but leave the actual parameterization to be defined in each test that is associated with the object repository that contains the parameterized test object property values.

Repository parameters are useful when you want to create and run tests on an object that changes dynamically.

Repositoriescollection is a collection of object that enables you to programmatically manage the run-time collection of shared object repository files associated with the current action.


Can i record a web based application on Mozilla??

We can record but not as a web applications but a standard windows application

example:


Window("Mozilla Firefox").WinObject("MozillaWindowClass").Type "uft"


How can you execute javascript on QTP/UFT??

First we have to go this link 

HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Configuration_UI\ScriptMgr

Create a new String value with name AltProgID and value "Mercury.JSScriptMgr" and change the value of "Create" to 1

Create a new child key inside the key
HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Configuration_UI\ScriptConstants
{0ECD5785-BE7D-11d4-8EAF-11135659EC56}

Repeat the same steps for the below key
HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Configuration

Open
C:\Program Files\Mercury Interactive\QuickTest Professional\bin\QTEditor.ini
Add the below parameter to [General options]
AllowJavaScript = 1
DisableVBScript = 1


What are the disadvantages of smart identification.??

There are many out of which is time consuming it eats lot of time and some times it yields wrong results also in case of dynamic environment.


If u enable smart identification when particular object description is mismatched it will take much time to recognize that object. And for identifying which object decryption is mismatched we have to verify the qtp results.

If disable smart identification qtp will through error in that particular statement



Tuesday, 6 October 2015

Commonly asked Question from Vb-Script

1. Given Number is Prime or not?

Maths: A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.
Logic: Starting from 2 divide the given number till half of the number, if the remainder is zero then the number is not a prime number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
userInput = Inputbox ("Enter any number")
i=2
Do While i < userInput/2
    If userInput Mod i = 0 Then
        flag = 1
        Exit Do
    End If
    i=i+1
Loop
If flag = 1 Then
    Msgbox userInput & " is not a Prime number"
Else
    Msgbox userInput & " is a Prime number"
End If
Output:
5 is Prime number

2. Find the factors of a given number?

Maths: The factors of a number are all those numbers that can divide evenly into the number with no remainder.
Logic: starting from 1 divide the given number till half of the number, if the remainder is zero it is a factor of the given number.
1
2
3
4
5
6
7
userInput = Inputbox ("Enter any number other than Prime number")
For i = 1 to userInput/2 
    If userInput Mod i = 0 Then 
        print i 
    End If 
Next 
print userInput
Output:
1
2
4
5
8
10
20
25
40
50
100
200

3. Find factorial of given number?

Maths: Factorial is the product of all the numbers from 1 to n, where n is the user specified number.
1
2
3
4
5
6
factorialValue = 1
userInput = Inputbox ("Enter any number")
For i = 1 to userInput
    factorialValue = factorialValue * i 
Next 
Msgbox  factorialValue
Output:
120

4. Find greatest of three numbers?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
number1 = Inputbox ("First number: Enter any postive number")
number2 = Inputbox ("Second number: Enter any postive number")
number3 = Inputbox ("Third number: Enter any postive number")
 
If number1 > number2 AND number1 > number3 Then
    Msgbox "First number: " & number1 & " is greatest"
 
ElseIf number2 > number1 AND number2 > number3 Then
    Msgbox "Second number: " & number2 & " is greatest"
 
ElseIf number3 > number1 AND number3 > number2 Then
    Msgbox "Third number: " & number3 & " is greatest"
 
Else
    Msgbox "All numbers are equal"
End If
Output:
Second number: 587 is greatest

5. Swap 2 numbers without a temporary variable
1
2
3
4
5
6
7
8
9
10
11
12
number1 = Inputbox ("First number: Enter any postive number")
number2 = Inputbox ("Second number: Enter any postive number")
 
Print "Before swapping number 1: " & number1
Print "Before swapping number 2: " & number2
 
number1 = number1 - number2
number2 = number1 + number2
number1 = number2 - number1
 
Print "After swapping number 1: " & number1
Print "After swapping number 2: " & number2
Output:
Before swapping number 1:45
Before swapping number 2:65
After swapping number 1:65
After swapping number 2:45

6. Write a program to find sub datatype of a variable

1
2
3
4
5
6
7
8
9
10
11
12
13
14
userInput1 = 44
Msgbox TypeName(userInput1)
 
userInput2 = "44"
Msgbox TypeName(userInput2)
 
'Anything in the double quotes is considered as string.
'For integers Don't use double quotes
 
userInput3 = "TestNBug"
Msgbox TypeName(userInput3)
 
userInput4 = True
Msgbox TypeName(userInput4)
Output:
String

7. Write a program to generate Random Number

We have a predefined formula for random number generation
You need to enter the minimum and maximum limits.
1
2
3
4
5
min = 1
max = 100
Randomize
rNumber = Int((max-min+1)*Rnd+min)
Msgbox rNumber
Output:
66