Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts

Showing posts with label UFT 11.5. Show all posts
Showing posts with label UFT 11.5. Show all posts

VBScript Code to close the IE browsers and Internet Explorer not responding window


  • VBScript Code to close the IE browsers and Internet Explorer not responding window

Set WShell = CreateObject("WScript.Shell")
''This will close all the instances of task iexplore.exe.
''Parameter /f kills the process forcefully
WShell.Exec("taskkill /fi ""imagename eq iexplore.exe"" /f")
WScript.Sleep 100
''At time Internet explorer is not responding error is displayed
''The task has window title as internet explorer not responding.
''We can close the task based on window title with regular expression as Internet *
WShell.Exec("taskkill /fi ""WINDOWTITLE eq Internet*"" /f")
WScript.Sleep 100
''Once the window is closed, another window appear with similar title
'' which needs to be closed
WShell.Exec("taskkill /fi ""WINDOWTITLE eq Internet*"" /f")

  • VBScript Code to save the list of running tasks and save it in file abc.txt


''Below command will return the service for the process and save it in file abc.txt
  Set WShell = CreateObject("WScript.Shell")
''This will close all the instances of task iexplore.exe.
''Parameter /f kills the process forcefully
WShell.Exec("tasklist /fi /svc>test.txt")

Solution - ActiveX component can't create object: 'TDApiOle80.TDConnection'

We can connect to ALM using 'TDApiOle80.TDConnection' object in VBscript as shown below:



Function CreateALMConnection(uRLALM,strUserName,strPassword,strDomain, strProject)
 Set objALMConnection = CreateObject("TDApiOle80.TDConnection")
        objQCConnection.InitConnectionEx uRLALM
        objQCConnection.Login strUserName, strPassword
        objQCConnection.Connect strDomain, strProject
  
  ''/* Write the required code for transaction with 
               '' ALM once the connection is created
   
  objQCConnection.Disconnect            
        objQCConnection.Logout
        objQCConnection.ReleaseConnection
        Set objQCConnection = Nothing
End Function 

Some of the useful code for interacting with ALM from VBScript can be found at below location:


Copying files from ALM to local machine


While running the script in 64 bit machine, error message 'ActiveX component can't create object: 'TDApiOle80.TDConnection' is displayed. In case you encounter such error, you can run the script from SysWow64 location in Windows as : 


C:\Windows\SysWOW64\cscript.exe scriptfilewithPath.vbs


From cscript.exe, the script will run successfully

Understanding Insight Objects in UFT 11.5

With Unified Functional Testing, there were a lot of features like integrating GUI testing and API testing, introducing File Content Checkpoint, and create insight object or recording in Insight mode. 

In this article I will try to explain what this feature of Insight recording is and how to implement same.


Insight is an image-based identification ability, to recognize objects in application based on what they look like instead of using properties that are part of design. UFT stores an image of the object with insight test objects and uses this image as main description property to identify object in the application.


Together with insight property, UFT can use ordinal identifier to uniquely identify the object. Another property we can use is Similarity - Specifies how similar a control in the application has to be to the test object image for it to be considered a match. And Visual relation identifier can also be used to identify the object based on its relative position with respect to other objects in the application. 

Low points of insight object are we cannot add insight object from object spy and snapshots occupy a lot of disk space.

Adding Insight Objects :


UFT allow adding Insight object either in recording Mode or manually in object repository:

1.  Insight Recording

 When we record in UFT, There is option to select recording mode. The recording mode in UFT is default, analog, Low Level recording, and Insight recording. When we select recording mode as Insight recording, UFT records object as insight object for images and identifies rest of objects like edit box as window object WinObject and perform action on them.
Recording bar in UFT 11.5

2.   Insight Objects can be added through Object Repository.

Go to Resources>Object Repository. This will open Object Repository window. In Object Repository window, Navigate to Object>Add Insight objects to Local. This can also be added by icon as shown below.
Once we click on Add Insight objects to local, UFT asks to select Learn Mode which can be manual and automatic. Manual Mode provides magnifier to select minute objects in the application.

Adding object from object repository
Insight object is always added to the object repository as a child of the test object that represents its containing application, such as a Window or Browser object.
In the Editor, test object image is displayed in the step instead of the test object name. Enlarge Image is displayed on hovering over the object.

Options available to work with Insight in UFT 11.5:

UFT 11.5 provides following options for working with insight objects. Options for Insight Object are at Tools>Options>GUI Testing>Insight. This pane enables you to define options that customize how UFT handles Insight test objects when creating test object, and during record and run sessions.

Options to customize the insight object are as follows:

a.   Save the clicked coordinates as the test object’s Click Point when recording a test object.
b.   When recording a test, display mouse operations.
options for insight 
c.   When editing shows test object image in steps and displaying Select learn mode dialog box
d.  Snapshots for insight object takes a lot of disk space, we can provide option to limit test object image, maximum pixels around image, and maximum number of snapshots to save when recording a test object

 
option for insight


Unified Functional testing: Understanding New Features

Unified functional testing 11.5 is latest from HP on functional automation testing. Previously I worked with QTP 11.0, and there are many changes in QTP 11 and UFT 11.5. Let me share the changes that I encountered and new features in UFT 11.5. Unified functional testing helps to work with API  as well as GUI together and the IDE has changed a lot from QTP 11.

1. UI Interface: 


Interface for UFT 11.5 has changed a lot from QTP 11 and it seems as if I was working on a completely new tool.

a.   Creating a new test:

Now we can create an API Test as well as GUI Test. API Test is for testing API Interface whereas GUI Test is the normal test or QTP Test that we have been creating in the past.
creating a new test in QTP

b.   Keyword View: 

We cannot  view Keyword view and expert view in UFT 11.5 together. To view Keyword view, We have to select View>Keyword View. To go back from keyword view to expert view, select View>Editor.
How a test looks in UFT

c.   UFT 11.5 provides easy navigation to functions/classes in the editor as shown in the below screenshot.

d.   Menu Option have changed a lot In UFT 11.5, with separate menu item for ALM, and redesign and menu options shuffled from one tab to another.

e.   Provides creating solution in which we can manage test documents including tests, function libraries, business components and test flows.


2.Using Solution explorer

we can work with multiple tests in the solutions and can edit, manage multiple tests at the same time.

3.   One of the new features of UFT 11.5 is Insight for object Identification

, an image-based identification ability to recognize objects in your application based on what they look like, instead of using properties that are part of their design. This can be useful if you are working with an application whose technology is not supported by UFT, or with an application running on a remote computer. This is a new feature and will be discussed in details in next articles.

4.   Using File content checkpoint

we can verify the content of file and can be useful for comparing Pdf files or contents of PDF file. PDF, HTML, Word, TXT, and RTF file types are supported.

5.  UFT supports testing for QT and Adobe flex Applications.

6.  Supports Microsoft Office and plug-in controls.

7.  In API Testing, Using the soapUI to API Test conversion tool, you can convert soapUI tests to UFT API tests.

8.  With UFT, new versions in different environment are supported that were not supported in QTP 11

9.  Start Page of Unified function testing provide links to new features, communities, useful links, and support. Using this we can connect to other users for forum support and information.

10. We can set preference to automatically export run results in HTML or PDF format after every run session through Tools > Options > General tab > Run Sessions

11. Bitmap checkpoint now enables to specify multiple areas to compare or ignore within the bitmap checking. It also supports checking whether a specific image appears anywhere within the runtime bitmap.