As far i think both of them have their advantages and
disadvantages.
OR is simple and easy to identify the objects. but it
consumes too much of memory when it is loaded and it will
increase the execution time. And if you have multiple
object of similiar kind of object properties at times it
will fail to recoginzed and the script will fail.
But DP reduces the execution time. Script will not fail in
this b'coz ur just changing the required property of the
object, yes it true that initial work more that creating
object properties list in an excel sheet and load that
excel sheet during runtime. but this can be overridden buy
using XML file which is less in size and Quick in loading.
and it takes very less memory.
let me know if you have any comments on this.This Blog contains Tutorials , Interview Questions, Slides and Training Videos Related to QTP, VBScript, Quality Center, Manual Testing and Automation Frameworks.All The real time examples and best practices in the site makes you a complete testing professional.
Search here for all the info you want in this Blog
Showing posts with label qtp. Show all posts
Showing posts with label qtp. Show all posts
Using Object Repository is a advantage or disadvantage?
Labels:
automation,
descriptive,
object repository,
qtp
How To Create and Save a Word Document in VBScript
Set objWord = CreateObject("Word.Application")
objWord.Caption = "Test Caption"
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.Font.Name = "Arial"
objSelection.Font.Size = "18"
objSelection.TypeText "Network Adapter Report"
objSelection.TypeParagraph()
objSelection.Font.Size = "14"
objSelection.TypeText "" & Date()
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.Font.Size = "10"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration")
For Each objItem in colItems
objSelection.Font.Bold = True
objSelection.TypeText "ARP Always Source Route: "
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.ArpAlwaysSourceRoute
objSelection.TypeParagraph()
objSelection.Font.Bold = True
objSelection.TypeText "ARP Use EtherSNAP: "
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.ArpUseEtherSNAP
objSelection.TypeParagraph()
objSelection.Font.Bold = True
objSelection.TypeText "Caption: "
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.Caption
objSelection.TypeParagraph()
objSelection.Font.Bold = True
objSelection.TypeText "Database Path: "
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.DatabasePath
objSelection.TypeParagraph()
objSelection.Font.Bold = True
objSelection.TypeText "Dead GW Detection Enabled: "
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.DeadGWDetectEnabled
objSelection.TypeParagraph()
objSelection.Font.Bold = True
objSelection.TypeText "Default IP Gateway: "
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.DefaultIPGateway
objSelection.TypeParagraph()
objSelection.Font.Bold = True
objSelection.TypeText "Default TOS: "
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.DefaultTOS
objSelection.TypeParagraph()
objSelection.Font.Bold = True
objSelection.TypeText "Default TTL: "
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.DefaultTTL
objSelection.TypeParagraph()
objSelection.Font.Bold = True
objSelection.TypeText "Description: "
objSelection.Font.Bold = True
objSelection.Font.Bold = False
objSelection.TypeText "" & objItem.Description
objSelection.TypeParagraph()
objSelection.TypeParagraph()
Next
objDoc.SaveAs("C:\Scripts\Word\testdoc.doc")
objWord.Quit
Labels:
doc,
interview questions,
msword,
qtp,
tutorials,
vbscript,
Word.Application
How to Create a New Word Document
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Labels:
how,
interview,
interview questions,
qtp,
vbscript,
Word.Application
How to Get the List Of Microsoft Word Document Properties
On Error Resume Next
Set objWord = CreateObject("Word.Application")
Wscript.Echo "Active Printer:", objWord.ActivePrinter
For Each objAddIn in objWord.AddIns
Wscript.Echo "AddIn: ", objAddIn
Next
Wscript.Echo "Application:", objWord.Application
Wscript.Echo "Assistant:", objWord.Assistant
For Each objCaption in objWord.AutoCaptions
Wscript.Echo "AutoCaptions:", objCaption
Next
Wscript.Echo "Automation Security:", objWord.AutomationSecurity
Wscript.Echo "Background Printing Status:", objWord.BackgroundPrintingStatus
Wscript.Echo "Background Saving Status:", objWord.BackgroundSavingStatus
Wscript.Echo "Browse Extra File Type:", objWord.BrowseExtraFileTypes
Wscript.Echo "Build:", objWord.Build
Wscript.Echo "Caps Lock:", objWord.CapsLock
Wscript.Echo "Caption:", objWord.Caption
For Each objLabel in objWord.CaptionLabels
Wscript.Echo "Caption Label:", objLabel
Next
Wscript.Echo "Check Language:", objWord.CheckLanguage
For Each objAddIn in objWord.COMAddIns
Wscript.Echo "COM AddIn:", objAddIn
Next
Wscript.Echo "Creator:", objWord.Creator
For Each objDictionary in objWord.CustomDictionaries
Wscript.Echo "Custom Dictionary:", objDictionary
Next
Wscript.Echo "Customization Context:", objWord.CustomizationContext
Wscript.Echo "Default Legal Blackline:", objWord.DefaultLegalBlackline
Wscript.Echo "Default Save Format:", objWord.DefaultSaveFormat
Wscript.Echo "Default Table Separator:", objWord.DefaultTableSeparator
For Each objDialog in objWord.Dialogs
Wscript.Echo "Dialog:", objDialog
Next
Wscript.Echo "Display Alerts:", objWord.DisplayAlerts
Wscript.Echo "Display Recent Files:", objWord.DisplayRecentFiles
Wscript.Echo "Display Screen Tips:", objWord.DisplayScreenTips
Wscript.Echo "Display Scroll Bars:", objWord.DisplayScrollBars
For Each objDocument in objWord.Documents
Wscript.Echo "Document:", objDocument
Next
Wscript.Echo "Email Template:", objWord.EmailTemplate
Wscript.Echo "Enable Cancel Key:", objWord.EnableCancelKey
Wscript.Echo "Feature Install:", objWord.FeatureInstall
For Each objConverter in objWord.FileConverters
Wscript.Echo "File Converter:", objConverter
Next
Wscript.Echo "Focus In MailHeader:", objWord.FocusInMailHeader
For Each objFont in objWord.FontNames
Wscript.Echo "Font Name:", objFont
Next
Wscript.Echo "Height", objWord.Height
For Each objBinding in objWord.KeyBindings
Wscript.Echo "Key Binding:", objBinding
Next
For Each objFont in objWord.LandscapeFontNames
Wscript.Echo "Landscape Font Name:", objFont
Next
Wscript.Echo "Language", objWord.Language
For Each objLanguage in objWord.Languages
Wscript.Echo "Language:", objLanguage
Next
Wscript.Echo "Left", objWord.Left
Wscript.Echo "Mail System:", objWord.MailSystem
Wscript.Echo "MAPI Available:", objWord.MAPIAvailable
Wscript.Echo "Math Coprocessor Available:", objWord.MathCoprocessorAvailable
Wscript.Echo "Mouse Available:", objWord.MouseAvailable
Wscript.Echo "Name:", objWord.Name
Wscript.Echo "Normal Template:", objWord.NormalTemplate
Wscript.Echo "Num Lock:", objWord.NumLock
Wscript.Echo "Parent:", objWord.Parent
Wscript.Echo "Path:", objWord.Path
Wscript.Echo "Path Separator:", objWord.PathSeparator
Wscript.Echo "Print Preview:", objWord.PrintPreview
For Each objFile in objWord.RecentFiles
Wscript.Echo "Recent File:", objFile
Next
Wscript.Echo "Screen Updating:", objWord.ScreenUpdating
Wscript.Echo "Show Visual Basic Editor:", objWord.ShowVisualBasicEditor
Wscript.Echo "Special Mode:", objWord.SpecialMode
Wscript.Echo "Startup Path:", objWord.StartupPath
For Each objTask in objWord.Tasks
Wscript.Echo "Task:", objTask
Next
For Each objTemplate in objWord.Templates
Wscript.Echo "Template:", objTemplate
Next
Wscript.Echo "Top:", objWord.Top
Wscript.Echo "Usable Height:", objWord.UsableHeight
Wscript.Echo "Usable Width:", objWord.UsableWidth
Wscript.Echo "User Address:", objWord.UserAddress
Wscript.Echo "User Control:", objWord.UserControl
Wscript.Echo "User Initials:", objWord.UserInitials
Wscript.Echo "User Name:", objWord.UserName
Wscript.Echo "Version:", objWord.Version
Wscript.Echo "Visible:", objWord.Visible
Wscript.Echo "Width:", objWord.Width
For Each objWindow in objWord.Windows
Wscript.Echo "Window:", objWindow
Next
Wscript.Echo "Window State:", objWord.WindowState
objWord.Quit
Labels:
how,
interview questions,
qtp,
vbscript,
Word.Application
How To Add Formatted Data to a Spreadsheet
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "Test value"
objExcel.Cells(1, 1).Font.Bold = TRUE
objExcel.Cells(1, 1).Font.Size = 24
objExcel.Cells(1, 1).Font.ColorIndex = 3
How To Add Data to a Spreadsheet Cell
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "Test value"
Labels:
excel sheet,
Excel.Application,
qtp,
vbscript
How to handle dynamic objects in QTP?
Dynamic object is an object which changes its properties at the run time and thus its mandatory properties cant be predicted from the starting.
Regular Expression solves the problem of dynamic values in QTP.
Labels:
descriptive,
qtp
Script Debugging
The term debugging refers to the activity of a programmer trying to figure out the cause of a problem (or “bug”) in his or her program, and then taking steps to eliminate the problem.
What is Debugger?
A debugger is a tool to help programmers follow the logic of their code as it runs. This can aid not only in finding bugs, but also in simply understanding a program.
A debugger sits in between the complier and/ or runtime engine and the actual running program. (In the case of VBScript, the compiling step is invisible; the scripting engine complies the code for you when you run it.)
A typical debugger gives you various tools to help in watching and interacting with your code as it executes:
Breakpoints:A way to specify a certain line of code on which to pause program execution.The line of code you specify is called a breakpoint.
Example: If the problem you are having is deep down the code in your function, you would mark a certain line in the function as a breakpoint.The program would run up until the breakpoint is reached, at which point the program pauses execution, showing you the breakpoint line.
Step Into , Step Over, and Step Out: A way to step through your code one line at a time.
Step Into will bring the debugger into a procedure or function, If one is being called and if the code for it is in the scope of the debugger.This is useful when you suspect the procedure being called might have a problem.
Step over:Will do the opposite: If the line you are on calls a procedure or function, the debugger will execute it without stepping into it.This is useful when you are confident that the procedure being called is not part of the problem you’re debugging.
Add Watch:A way to view the value of all of the variables active at any given point in the code.While code execution is paused, mostly any debugger will have some way to view all of the variables active at that point in the code and what their values are.(Using Command Widow)
Call Stack:A way to view the “Call Stack” .The Call Stack is the nested sequence of function and procedure calls that have led to a certain point in the code.Example: The Call stack displayed the Main procedure which called the sub procedure and also sub procedure calling to another low-level procedure.
Labels:
errorhandling,
qtp
Running DOS Commands in QTP
You can run standard DOS commands in your QuickTest test or function using the VBScript Windows Scripting Host Shell object (WSCript.shell). For example, you can open a DOS command window, change the path to C:\, and run the DIR command using the following statements:
Dim oShell
Set oShell = CreateObject ("WSCript.shell")
oShell.run "cmd /K CD C:\ & Dir"
Set oShell = Nothing
Introduction to Automation
In Today’s world of software industry ‘Test automation’ is an important aspect of Software testing and quality. Now in this article we will discuss about
- What is software test automation.
- What is the need of software test automation.
- when and where it is applicable.
- Advantages and disadvantages of Software Test automation.
- We will also discuss the various myths about test automation.
Software Testing
Even though we have many definitions for software definition the main objective behind is “The Software testing is a process used to identify the correctness, completeness and quality of developed computer software.”
In reality, testing can never establish the correctness of the software. It can only find defects, not prove that there are none. The testing process is carried out either manually or using automation tools or an effective combination of both.
Manual Testing
It is defined as developing and executing tests that depends primarily on direct human interaction throughout the entire test lifecycle, especially in terms of evaluating correctness and validating test status.
Automation Testing
It is defined as developing the test cases that can run unattended, comparing the actual to expected results and logging status.
We can make the definition Simple by saying “Automating the manual testing process currently in use”
References Must Read:
Why and when we go for automation ?.
Myths about Automation testing
Labels:
automation,
introduction,
qtp,
test,
when,
why
Subscribe to:
Posts (Atom)