Professional Documents
Culture Documents
using Childnodes
For the given XML File to read data below is the code
Set xm=CreateObject("Microsoft.XMLDOM")
xm.load "e:\xmlf\book.xml"
Set c1=xm.documentElement.childNodes
For i=0 to c1.length-1
msgbox c1.item(i).nodeName
set c2=c1.item(i).childNodes
for j=0 to c2.length-1
msgbox c2.item(j).text
next
Next
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:29 AM 0
comments
Monday, April 18, 2011
manipulate XML File using Microsoft.XMLDOM
Example :Existing xml file "book.xml"
==========================
==========================
xm.save "e:\book.xml"
===========================================
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 1:15 AM 0
comments
Microsoft.XMLDOM
Below are the methods used to access and manipulate XML documents via the XML DOM
implementation
Reference : http://msdn.microsoft.com/en-us/library/ms757828(v=vs.85).aspx
Method
Description
abort (DOMDocument)
abort (IXMLHTTPRequest)
abort (ServerXMLHTTP/IServerXMLHTTPRequest)
add
addCollection
addObject
addParameter
appendChild
of the node.
appendData
clone
cloneNode
createAttribute
createCDATASection
createComment
createDocumentFragment
Creates an empty
IXMLDOMDocumentFragment object.
createElement
createEntityReference
createNode
createProcessingInstruction
createProcessor
createTextNode
errorParameters
deleteData
DllSetProperty
get
getAllResponseHeaders (IXMLHTTPRequest)
getAllResponseHeaders
(ServerXMLHTTP/IServerXMLHTTPRequest)
getAttribute
getAttributeNode
getDeclaration
getElementsByTagName (DOMDocument)
getElementsByTagName (IXMLDOMElement)
getNamedItem
getOption
getProperty (IXMLDOMDocument2)
getProperty (IXMLDOMSelection)
Returns a property.
getQualifiedItem Method
getResponseHeader (IXMLHTTPRequest)
getResponseHeader
(ServerXMLHTTP/IServerXMLHTTPRequest)
getSchema Method
hasChildNodes
hasFeature
importNode
insertBefore
insertData
item (IXMLDOMNodeList)
item (IXMLDOMNamedNodeMap)
load
loadXML
matches
nextNode (IXMLDOMNodeList)
nextNode (IXMLDOMNamedNodeMap)
nodeFromID
normalize
open (IXMLHTTPRequest)
open (ServerXMLHTTP/IServerXMLHTTPRequest)
peekNode
remove
removeAll
removeAttribute
removeAttributeNode
removeChild
removeNamedItem
removeNext
removeQualifiedItem
replaceChild
replaceData
reset (IXMLDOMNamedNodeMap)
reset (IXMLDOMNodeList)
reset (IXMLDOMParseErrorCollection)
reset (IXSLProcessor)
save
selectNodes
selectSingleNode
send (IXMLHTTPRequest)
send (ServerXMLHTTP/IServerXMLHTTPRequest)
setAttribute
setAttributeNode
setNamedItem
setOption
setProperty
setProxy
setProxyCredentials
setRequestHeader (IXMLHTTPRequest)
setRequestHeader
(ServerXMLHTTP/IServerXMLHTTPRequest)
setStartMode
setTimeouts
splitText
substringData
transform
transformNode
transformNodeToObject
validate
validate
Performs run-time validation on the
(IXMLDOMSchemaCollection2/XMLDOMSchemaCollection documents in the schema cache that have
not been compiled and validated.
validateNode
waitForResponse
TestObjects are the objects in the Repository and these Objects are used in the Test ( Script),,, see any
object in the repository are under TestObject Structure
Learn the step by step procedure how to Register user created function to any test object and when
writing the Script our Created function is also displayed in the Intellisence
1. Open Notepad
2. Write the Required Function
3. Write statement to Register the userfunction to the required testobject
4. Save the file as Filename.vbs
=========================
For the above 4 steps in notepad (sample function fn_sample is Defined and registered as below)
In Notepad
public Function fn_sample
msgbox "Hello"
End Function
Registeruserfunc "WinButton","myfunc","fn_sample"
In the above code fn_sample is registered for WinButton and in the script in Intellisence "myfunc" is
displayed
===========================
5. After saving the file,,, associate the library to the QTP Test
File menu---Settings---Resource----Associate function library (and select the above created library and
associate)
7. Write script
Dialog("Login").winButton("OK").myfunc
Dialog("Login").WinButton("Cancel").myfunc
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 10:58 AM 0
comments
Tuesday, April 12, 2011
using Dotnetfactory Examples
''''Write Text into the file
Dim df
Set df=Dotnetfactory.CreateInstance("System.IO.File")
df.writealltext "d:\online\data.txt","this is sample"
'''Read text from the file
Dim df,s
Set df=Dotnetfactory.CreateInstance("System.IO.File")
s=df.readalltext("d:\online\data.txt")
msgbox s
'''Convert the date into req format
Dim df , d
Set df=Dotnetfactory.CreateInstance("System.DateTime")
Set d=df.Parse("Tue, 12 Apr 2011")
msgbox d.Day & "/" & d.Month & "/" & d.Year
Note : for more Classes, Methods Refer msdn.microsoft.com
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 3:53 AM 0
comments
Reg QTP 10 and Firefox 3.6 browser
Hi ,,
some of the students are trying to run the scripts on firefox browser and facing problems,,, Like working
with IE you cannot directly work with Firfox browser,,,, the below patch need to be downloaded and
installed in you system
and for complete list of environments supported by QTP is available in QTP Readme file.
Note: To enable QuickTest to run tests in Firefox 3.6 on a machine with UAC enabled, you need to start
QuickTest
once using "Run as administrator" after installing the patch and Firefox 3.6.
Additional information about this patch and the patch download are available at the HP Software
Support Online website:
http://h20230.www2.hp.com/selfsolve/document/FID/DOCUMENTUM_QTPWEB_00059
wend
msgbox "Is repeated times are "&cnt
==================================
''''Another logic
s="This is sample"
a=split(s,"is")
msgbox "Is is repated for "&ubound(a)
====================================
'''Another Logic
s="This is sample"
cnt=0
For i=1 to len(s)
a=mid(s,i,2)
If a="is" Then
cnt=cnt+1
End If
Next
msgbox "is repeated for "&cnt
dim d
set d=Description.Create
d("micclass").value="Browser"
set a=Desktop.ChildObjects(d)
for i=0 to a.count-1
a(i).close
Next
2. There are 10 browsers and in that 1 browser is mercury tours website.... except mercury tours
browser all the other browsers should be closed
'' Get all the browsers and for each browser get the title
'' in the title if "mercury" word is not there then close
dim d
set d=Description.Create
d("micclass").value="Browser"
set a=Desktop.ChildObjects(d)
for i=0 to a.count-1
s=a(i).getROProperty("title")
if instr(1,s,"Mercury")=0 Then
a(i).close
End if
Next
Publish Post
1. using DotnetFactory
''below is the syntax to refer DLL and call the methods
Dim myobj
Set myobj=DOTNetFactory.CreateInstance("namespace.class", "path of the dll")
myobj.method ''to call the method
myobj.property '' to access the property
else
MsgBox "Notepad window found"
end if
----------------------------Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 12:55 AM 0
comments
Wednesday, December 15, 2010
DotNetFactory Introduction---1
DotNetFactory
This utility object is available from QTP 9.2 onwards and all the versions after 9.2,
This utility object you can see in Insert menu--->Step Generator---->utility object Category---->Select in
Object List
This Object Provides QTP scripting to access methods and properties of a .NET object by creating an
instance for this object.
Syntax :
Dim d
set d=CreateInstance(Typename,assembly,parameters)
Typename : name of the object
assembly (optional): if it is already preloaded assembly then no need to specify else we have to specify
the assembly ie. the DLL which has the typename
parameters: specify the parameters if typename has any input parameters.
Note : Refer in msdn.microsoft.com for all the System Namespace and its classess, .Net Class Library
list,,, below is the link
http://msdn.microsoft.com/en-us/library/d11h6832(v=VS.71).aspx.....
Few Examples :
Example 1:
' Display our own message Created from System.Windows.Forms.MessageBox --Typename ,, which
belong to System.Windows.Forms Assembly
Dim msg
Set msg = DotNetFactory.CreateInstance("System.Windows.Forms.MessageBox",
"System.Windows.Forms")
msg.show "This is Venkat","Sample"
-------------------------------------------------Example :2
'Display our own window /Form
Dim frm1
Set frm1 = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")
frm1.Text = "Venkat"
frm1.Maximizebox = True
frm1.Minimizebox = True
frm1.Width = 500
frm1.Height =200
frm1.Location.X = 50
frm1.Location.Y = 200
frm1.Show
--------------------------------------Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:51 PM
Set xl=CreateObject("Excel.Application")
xl.WorkBooks.Add()
Set ws=xl.ActiveSheet
r=1
For Each b In bglist
ws.Cells(r, 1).Value =b.Field("BG_BUG_ID")
ws.Cells(r, 2).Value = b.Summary
ws.Cells(r, 3).Value = b.DetectedBy
next
---------------------------------------------------------script to display the list of actions and their details
---------------------------------------------------------Dim app
set app=CreateObject("QuickTest.Application")
app.launch
app.visible=True
app.open "c:\test1"
redim a(app.Test.Actions.count)
for i=1 to app.Test.Actions.count
a(i-1)=app.Test.Actions.item(i).name&" "&app.Test.Actions.item(i).type&"
"&app.Test.Actions.item(i).location
next
for i=0 to ubount(a)
print a(i)
next
=========================================
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 11:06 PM
Internet Explorer Developer Toolbar (sometimes shortened to IE Developer Toolbar or even IE DevBar),
is an add-on for Internet Explorer 6 and Internet Explorer 7 that aims to aid in design and debugging of
web pages. It allows validating of CSS and HTML, previewing page layout at various resolutions, and also
offers a ruler (measuring in pixels) to aid in positioning the elements. It allows viewing the source of the
entire page, color coded for ease of navigation, or selected elements of it, as well as view the DOM
source and the CSS selectors that are applied to the element. It also enables viewing the properties and
styles of individual elements and also trace styles of elements to its declaration.
The toolbar includes a toggleable pane at the bottom of the window . The pane shows the structure of
the web page; and for each structure, the properties and styles. It exposes its features through a menu
hierarchy, and also includes toolbar buttons for quick access to features like clearing the browser cache
and enable selecting elements by clicking in the rendered page, rather than navigating through the
visual representation of the DOM tree
Example IE DevBar
Cloud computing is a general term for anything that involves delivering hosted services over the
Internet. These services are broadly divided into three categories:
Infrastructure-as-a-Service (IaaS),
Platform-as-a-Service (PaaS)
Software-as-a-Service (SaaS).
The name cloud computing was inspired by the cloud symbol that's often used to represent the Internet
in flowcharts and diagrams.
A cloud service has three distinct characteristics that differentiate it from traditional hosting. It is sold on
demand, typically by the minute or the hour; it is elastic -- a user can have as much or as little of a
service as they want at any given time; and the service is fully managed by the provider (the consumer
needs nothing but a personal computer and Internet access). Significant innovations in virtualization and
distributed computing, as well as improved access to high-speed Internet and a weak economy, have
accelerated interest in cloud computing.
A cloud can be private or public. A public cloud sells services to anyone on the Internet. (Currently,
Amazon Web Services is the largest public cloud provider.) A private cloud is a proprietary network or a
data center that supplies hosted services to a limited number of people. When a service provider uses
public cloud resources to create their private cloud, the result is called a virtual private cloud. Private or
public, the goal of cloud computing is to provide easy, scalable access to computing resources and IT
services.
Infrastructure-as-a-Service like Amazon Web Services provides virtual server instances with unique IP
addresses and blocks of storage on demand. Customers use the provider's application program interface
(API) to start, stop, access and configure their virtual servers and storage. In the enterprise, cloud
computing allows a company to pay for only as much capacity as is needed, and bring more online as
soon as required. Because this pay-for-what-you-use model resembles the way electricity, fuel and
water are consumed, it's sometimes referred to as utility computing.
Platform-as-a-service in the cloud is defined as a set of software and product development tools hosted
on the provider's infrastructure. Developers create applications on the provider's platform over the
Internet. PaaS providers may use APIs, website portals or gateway software installed on the customer's
computer. Force.com, (an outgrowth of Salesforce.com) and GoogleApps are examples of PaaS.
Developers need to know that currently, there are not standards for interoperability or data portability
in the cloud. Some providers will not allow software created by their customers to be moved off the
provider's platform.
In the software-as-a-service cloud model, the vendor supplies the hardware infrastructure, the software
product and interacts with the user through a front-end portal. SaaS is a very broad market. Services can
be anything from Web-based email to inventory control and database processing. Because the service
provider hosts both the application and the data, the end user is free to use the service from anywhere.
Future Testing
New trends in testing
New and emerging technologies such as Service Oriented Architecture (SOA), Software-as-a-Service
(SaaS), Cloud Computing, virtualization and advent of mobile technologies are radically changing the
trends in application testing. Some of the recent trends in software testing domain indicate an
upsurge in:
a) SOA Testing
b) Security testing
c) Testing in Cloud Computing environments
d) Tool based regression automation and performance testing
e) On-demand testing services
f) Risk-Based testing
g) VoIP application testing
h) Health care
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:44 AM
WR2QTP
There are two approaches that one can take for migration:
1. Perform the conversion manually: This is a costly and error-prone process as the logic of each TSL
script has to be understood, the object map manually recorded and then the QTP scripts constructed.
This approach works only if the code base is small.
2. Build a language translator that automatically converts WinRunners GUI-map files and scripts to
QTPs object map files and scripts. Two companies have already built such translators in the past,
however, both these translators (Win-Quick and QTP Genie) convert only around 80% of the code. Rest
of the conversion has to be
done manually. This manual conversion step requires understanding the script code in order to correct
it. Significant investment of time is needed. One could argue that a translation-based approach that is
not nearly 100% automatic is no better than the manual approach.
INTEROPERATES DISRUPTIVE WR2QTP TRANSLATOR
Interoperate has recently developed a translator that converts WinRunner scripts to QTP with nearly
100% automation. Interoperates translator relies on a path-breaking Technology based on formal
semantics and rule-based languages that allows translators for the most complex languages to be
constructed in a few months as opposed to a few years.
ReadMore: http://www.interoperate.biz/Interoperate_WhitePaper%20WR2QTP.pdf
DOM Scripts
Try the below Scripts using Document Object Model on Google web page
ADD Google webpage in Repository
s=Browser("Google").Page("Google").Object.cookie
msgbox s
s=Browser("Google").Page("Google").Object.documentElement.innerhtml
msgbox s
s=Browser("Google").Page("Google").Object.documentElement.innertext
msgbox s
s=Browser("Google").Page("Google").Link("Hindi").Object.currentStyle.color
msgbox s
s=Browser("Google").Page("Google").Link("Hindi").Object.currentStyle.fontfamily
msgbox s
s=Browser("Google").Page("Google").Object.readyState
msgbox s
s=Browser("Google").Page("Google").Object.url
msgbox s
s=Browser("Google").Page("Google").Object.getElementsByName("INPUT")
msgbox s
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 8:57 PM 0
comments
Sunday, May 2, 2010
Descriptive Example
''' Descriptive Code for Flight Application Login
Dim a,p,k
Set dl=fn_createobj("text:=Login")
Set a=fn_createobj("attachedtext:=Agent Name:,nativeclass:=Edit")
Set p=fn_createobj("attachedtext:=Password:,nativeclass:=Edit")
Set k=fn_createobj("text:=OK")
with Dialog(dl)
.WinEdit(a).set "abcd"
.WinEdit(p).set "mercury"
.WinButton(k).Click
End With
Function fn_createobj(s)
Dim d
Set d=Description.Create
n=split(s,",")
For i=0 to ubound(n)
m=split(n(i),":=")
d(m(0)).value=m(1)
Next
Set fn_createobj=d
End Function
=============================
'' Descriptive code to Enter Venkatgn in Google and read the results
with Browser("CreationTime:=0").page("micclass:=Page")
.WebEdit("name:=q","html tag:=INPUT","type:=text").Set "Venkatgn"
.WebButton("name:=Google Search","type:=Submit").Click
r= .webelement("innertext:=(\d*,\d*){1,}").getROProperty("innertext")
End With
msgbox "Total Results "&r
Browser("CreationTime:=0").Back
=================================
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 8:59 PM
"http://192.168.1.1:8080/qcbin","Default","proj1","venkat",,false
'''Script to Connect to QC and Add a new Defect in QC from QTP
Dim qccon
Set qccon=CreateObject("TDApiOle.TDConnection")
qccon.InitConnection "http://qcserverurl:8080/qcbin"
qccon.ConnectProject "proj1","venkat",""
If qccon.Connected Then
Msgbox "Connected to QC Server
Else
MsgBox "Not Connected"
End If
Set BugFactory = qccon.BugFactory
Set Bug = BugFactory.AddItem(Nothing)
Bug.Status = "New"
Bug.Summary = "Error in login"
Bug.Priority = "4-Very High"
Bug.AssignedTo ="user1"
Bug.DetectedBy = "venkat"
Bug.Post
' Close QTP After execution of the Test
set wm=GetObject("winmgmts:\\.\root\CIMV2")
Set pros=wmi.ExecQuery("Select * from Win32_Process Where Name = 'QTPro.exe'")
For Each p in pros
p.Terminate()
Next
Set wmi=Nothing
Set pros=Nothing
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 5:11 AM 0
comments
Monday, April 19, 2010
Interview Scripts---3
'' Take few records of emp details in cells A1 to C4 for practise like eno, ename,sal
Dim d,brlist,idx
Set d=Description.Create
d("micclass").value="Browser"
Set brlist=Desktop.ChildObjects(d)
idx=brlist.count-1
Browser("creationtime:="&idx).close
Set d=Nothing
Set brlist=Nothing
'''' VBScript to Display All the Properties of All the objects in WebPage
Set d=Description.Create
Set App = CreateObject("QuickTest.Application")
Set qtIdent = App.Options.ObjectIdentification
qtIdent.ResetAll
set objList=browser("micclass:=Browser").page("micclass:=Page").ChildObjects(d)
For i=0 to objList.count-1
objList(i).highlight
oClassName=objList(i).getroproperty("micclass")
Set qtObject = qtIdent.Item(oClassName)
set PropColl=qtObject.AvailableProperties
print "*******************************************************"
For oPropCount=1 to PropColl.count
print PropColl.item(oPropCount) & ":="& objList(i).getroproperty(PropColl.item(oPropCount))
Next
print "*******************************************************"
Next
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 9:23 PM
The RegisterUserFunc statement now has an optional argument that you can use to set a
function as the default operation for a test object.
You can use the new Function Definition Generator to easily generate user-defined functions
(Insert > Function Definition Generator).
NEW!! You can manage the availability of keywords used to create keyword-driven components
using the new Keywords pane in the application area of QuickTest Professional.
NEW!! You can associate a function library with the open test by opening the function library
and choosing File > Associate Library 'library_name' with 'test_name'.
NEW!! You can check syntax errors by clicking CTRL + F7. If your script contains errors you can
view them in the new Information pane.
The Select Object for Step dialog box enables you to select a new object from your application. If
you select an object in your application that is not in the object repository, the object is added
to the object repository when you insert the new step.
You can select an object in the object repository and locate it quickly in your application using
the Highlight button in the ORM or ORE.
NEW!! You can locate an object in the object repository by pointing to an object in your
application. If the object exists in the object repository, it is highlighted.
NEW!! You can now add new objects to the object repository using filtering capabilities. For
example, you can choose to add only a selected type of object residing in a window or a web
page/frame.
NEW!! You can now associate multiple object repositories with an action or application area. In
previous versions of QuickTest Professional, you could associate only a single object repository
with a test asset.
NEW!! You can export object repository content to an XML file and import a new object
repository from an XML file.
The list of Utility objects available when you open the Step Generator from the Keyword View is
a sub-group of the list available when you open the Step Generator from the Expert View.
Open XML format used for report information now enables you to easily customize run reports
and integrate result information with other applications. Refer to the QuickTest online
documentation for a detailed description of the report's XML elements.
You can export test results to an HTML file to easily view the test results when you are not
working in a QuickTest environment.
You can write automation scripts to control virtually every QuickTest feature and capability
using the objects, methods, and properties included in the QuickTest Professional automation
object model.
When you type VBScript keywords in the Expert View, the relevant VBScript syntax or blocks are
added to the test script.
You can now locate specified text strings in the Expert View, and replace them with text strings
that you specify. You can search for literal text or use advanced options to fine-tune your
search.
NEW!! You can select a block in the Expert View and press CTRL + M to comment this block.
Press SHFT + CTRL + M to uncomment the block.
NEW!! You can select a block in the Expert View and indent or outdent it by clicking the Indent
or Outdent toolbar buttons.
NEW!! You can control the layout of the QuickTest Professional Window by dragging and
dropping panes to a dockable, floating, and tabbed mode.
NEW!! To move a dockable pane without snapping it into place, press CTRL while dragging it to
the required location.
NEW!! To auto-hide all the tabbed panes, select the title bar of the active tabbed pane, rightclick and choose Auto Hide.
NEW!! When you rename a test object, you can choose whether to automatically update all
occurrences of the test object, or manually change the names in steps that use the renamed test
objects.
NEW!! You can copy objects from a shared object repository to the local object repository in
order to modify them.
NEW!! You can use the Object Repository Merge Tool to merge objects from two shared object
repositories into a single object repository.
NEW!! You can associate shared object repositories with multiple actions simultaneously, using
the Associate Repositories dialog box.
NEW!! You can resolve missing resources (such as missing object repositories and actions), using
the new Missing Resources pane.
You can use the Advanced Windows Applications Options dialog box to modify how QuickTest
records and runs tests on Windows applications. Choose Tools > Options > Windows
Applications tab > Advanced.
You can save the resulting data from the run-time Data Table to a file by inserting a
DataTable.Export statement to the end of your test.
To instruct QuickTest to wait for an object to open or appear during test run, use an Exist or
Wait statement.
To stop an analog step in the middle of a test run, click Ctrl + Esc, and then click the Stop toolbar
button.
If you want to create a bitmap checkpoint of multiple objects, select the object in the Object
Selection dialog box that includes all the objects you want your bitmap checkpoint to contain.
If you need to recover Active Screen files after you save a test without Active Screen files, rerecord the necessary steps or use the Update Run option to recapture screens for all steps in
your test.
You can use a PathFinder.Locate statement in your test to retrieve the complete path that
QuickTest uses for a specified relative path based on the folders specified in the Folders tab.
You can define a recovery scenario to handle unexpected behavior during your run session.
You can add new objects to the Object Repository from the Active Screen or using the Add
Objects option in the Object Repository dialog box and pointing to the object in your
application.
To record keyboard input, mouse clicks, and the exact path the mouse travels, switch to Analog
Recording mode or Low Level Recording mode.
If it takes time for an object you are checking to load all of its data, you can increase the
checkpoint timeout.
You can verify that your XML is structured according to a specific schema.
You can specify a relative path when calling actions, functions, and other external files
associated with or referenced by a test or business component.
NEW!! You can create library files (containing VBScript functions, subroutines, classes, modules,
and so forth) in QuickTest Professional and associate them with your test or application area.
You can then call these functions (or other elements) from within your test assets.
NEW!! You can debug functions, subroutines and classes defined in a function library file in
QuickTest Professional.
You can create a user-defined function and register it as a test object method in order to
overwrite or add to existing test object functionality.
You can use the Reporter object to disable or enable messages to the Test Results.
You can record a test on one version of Microsoft Internet Explorer and then run it on other
browsers or versions.
To transfer control to the application while spying or inserting checkpoints on objects, press the
CTRL key.
You can check the content of an image in a Web page when you create an image checkpoint
using the Compare Image Content option.
You can use the Data Table to run the test several times, each time using different data.
By default, in order to conserve disk space, QuickTest does not save screen captures with your
test results for steps that pass. You can change the default setting in the Tools > Options > Run
tab.
The Active Screen loads faster if you clear the Load Images check box in the Web Page
Appearance dialog box (Tools > Options > Active Screen tab > Advanced button).
You can teach QuickTest to recognize any area of your application as an object by defining it as a
virtual object.
From QuickTest, you can run WinRunner tests and call TSL functions in compiled modules. The
results of the WinRunner test or function are integrated into the QuickTest test results.
To modify the text used for a text checkpoint, click the Configure button in the Text Checkpoint
Properties dialog box.
You can configure an action for repeated use in your test and in other tests. Select the Reusable
Action check box in the Action Properties dialog box (Edit > Action > Action Properties).
You can use the ExitAction statement to terminate an action before it finishes running, based on
conditions you specify in your test.
You can set breakpoints in your test, and then use the Debug Viewer pane to view, set, or
modify the current value of objects or variables.
You can call methods and retrieve and set COM object properties from the Expert View using
the .Object property.
You can configure how QuickTest records events in Web applications. Choose Tools > Web Event
Recording Configuration.
You can define custom environment variables for use in your test.
You can use the Window Script Host and the VBScript Runtime Library to further extend your
test. For more information choose Help > QuickTest Professional Help > VBScript Reference.
You can use the Object Identification dialog box to configure the way QuickTest learns and
recognizes objects.
You can run your test in Update mode to update values in your test or business component. You
can choose to update checkpoint data, Active Screen images, and/or the descriptions of the
objects in the object repository. Choose Automation > Update Run Mode.
If you want to add the same comment to every action that you create, you can add the
comment to an action template.
You can define test or action parameter variables using the Parameter object and its methods in
the Expert View.
You can create test, action, or component parameter output values that retrieve values during
the run session and store them for use at another point in the run session. You can then use
these output values to parameterize a step in your test or business component.
NEW!! You can create object repository parameters. When associating an object repository to a
test asset, you map this parameter to a constant or a test asset parameter (test, action, or
business component).
In addition to Data Table output values, you can output values to environment variables or store
a retrieved value in a test, action, or component parameter.
You can use the Data Driver Wizard to automatically parameterize constants in your action or
business component.
You can specify test, action, or component parameters to pass values to and from your test or
business component, and between actions in your test.
The Operation item appears in the Keyword View only when functions are defined in function
library files associated with the components application area.
When adding a new step using the Keyword View or Step Generator, you can select a new
object from your application and it is automatically added to your object repository.
You can specify which columns you want to display in the Keyword View. Choose Tools > View
Options or right-click any column header in the Keyword View.
You can specify the order in which columns are displayed in the Keyword View. Choose Tools >
View Options or drag a column header to a new location in the Keyword View.
You can print the contents of the Keyword View to your Windows default printer, or preview it
on screen before printing. Click the Print button or choose File > Print.
You can copy and paste or drag and drop steps in order to move them to a different location
within the Keyword View.
You can enter a comment about a step in the Keyword View by clicking in the Comment cell. You
can also enter a comment on a new line below the currently selected step by choosing Insert >
Comment.
You can view the Documentation column in the Keyword View to read a summary of what the
step does, in an easy-to-understand sentence.
The Function Definition Generator enables you to add documentation that specifies exactly
what a step using your function does. This description is shown in the Documentation column of
the Keyword View for steps that use the function.
NEW!! You can copy the content of the Documentation column to the Clipboard by right-clicking
any column header in the Keyword View and choosing Copy Documentation to Clipboard.
You can print a single action or business component from the Keyword View (in table format) or
from the Expert View (in statement format).
You can create a custom report message from the Keyword View by choosing Insert > Report.
NEW!! Business components associated with an application area use only the resources and
settings that are defined in the application area. In previous versions of QuickTest Professional,
business components could have custom settings.
If you are connected to Quality Center, you can view the current Quality Center connection by
pointing to the Quality Center icon in the status bar. To open the Quality Center Connection
dialog box, double-click the Quality Center icon.
If a Quality Center test or shared file (such as a shared object repository or Data Table file) is
open when you disconnect from Quality Center, then QuickTest closes it.
To access QuickTest tests or components from Quality Center, select the 'Allow other Mercury
products to run tests and components' check box (Tools > Options) and install the QuickTest
Add-in for Quality Center (from the QuickTest Professional CD-ROM).
NEW!! If a business component is currently open, clicking the New toolbar button creates a new
business component document (and not a new test document). This also applies if an
application area or function library is open.
NEW!! You can open a recently used business component, application area, or function library
by selecting it from the Recent Files list in the File menu.
You can run QuickTest tests from a Quality Center project and pass parameter values to the test.
You can choose a Web server accessible via a Local Area Network (LAN) or a Wide Area Network
(WAN) when connecting to Quality Center. Click the Quality Center Connection button or choose
File > Quality Center Connection.
The Open Test from Quality Center Project dialog box displays icons that indicate the version
control status of each test in your project.
FAQ-2
1. What is difference between QTP 9.2 , QTP 9.5 and 10.00
2. What is difference between low level recording and analog recording.
3. How to parameterize data to the QTP.
4. how to load Object Repository during RunTime
5. what is local and shared repository.
6. what is the extension of QTP Script file
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:31 AM 0
comments
Friday, April 2, 2010
Manual FAQ-1
1. what is Defect Triaze
Triaze meeting is conducted to list all the open defects and list which are possible to fix and not possible
to fix because of schedule.
2. Defect cluster
Defects are found in groups
3. Explain Defect life cycle
4. Explain the levels of Testing
unit testing, integration testing, system testing
5. what is alpha testing and beta testing
6. What is verification and validation
7. what is prototype
8. What is project TEsting and product TEsting
9. What is webservice
10. What is intranet and Internet
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:00 AM
Hi,
Below are the differences you can tell between the QTP versions; those who are putting up QTP
experience; in the project point of you it is suggested to put QTP 9.2 / 9.5 but you can mention in the
Skill set that QTP 10.00 you have knowledge
Note: All the new Features of QTP 9.5 are available in QTP 10.00 and QTP 10.00 has new features
compared to QTP 9.5
New Technologies :
1.PowerBuilder
2. Delphi
3. Oracle Forms 10 Apps 12
4.StingRay Objective Grid 10, 114. PeopleSoft 9.0
5.New Terminal Emulator versions
6.NET 3.5 (beta)
New environments :
1.Windows Vista 64 bit
2. Eclipse 3.2, 3.3
3.Record on SWT
4. Firefox 3.0
5.Netscape 9
New Features of QTP 10.00
1. Centrally Manage and Share Testing Assets, Dependencies, and Versions in Quality Center 10.00
In the earlier version of QC, the Test Assets like ( Repository, Library, Recoveries ) are placed in the
Attachments and if these assets are associated to the Test there is no dependencies information.
In QC 10.00 there is a new Section called Test Resources in the section we can place all the Assets and
associate these to the Test Script. The QC tool maintains the dependencies information between the
Assets and Test Script.
It also provides build in Version control; when the Test case/ scripts ...etc is checkout and checkin into
QC it will maintain a new version which is similar concept in VSS.
2. Perform Single-User Local System Monitoring While Running Your Tests
we can observe the performance of the local system when the script is executed. Like usage of memory,
GDI objects, Thread counters.
Navigation: To select the Local System Motitoring
File menu-->Settings--> Local System Monitoring
Select the Enable Local System Monitoring every seconds
Select the Application name
Select the counter and Limit size
After the Test Run, the status is shown in the Test Results
3. Improve Portability by Saving Copies of Tests Together with Their Resource Files
When we save the test from QC into local system ; all the associated assets like Object Repositories,
Function Libraries, Recovery Scenarios are also copied to the local system and we can run the script
from local system with out any change in the assoication assets path / with out any changes.
Steps :
Open the Test in QTP which is in the QC
File menu select Save Test with Resources
Following type of details are displayed
select the location in local system to save the file and save
4. Call Actions Dynamically During the Test Run
we can dynamically load and run actions instead of Call to Existing action and associating the reusable
Actions. These action is loaded into memory and run only when the statement is executed and not
during the Test / Action open.
Syntax: Loadandrunaction Path of QTP test,Actioname
5. Develop Your Own Bitmap Checkpoint Comparison Algorithm
6. Centrally Manage Your Work Items and ToDo Tasks in the To Do Pane
we can make a note of all the tasks to be perfomed in the TODO Pane
View menu--> To Do List
7. Improve Test Results Analysis with New Reporting Functionality
manipulating test actions and action parameters. We can now use automation scripts to create new
actions, modify and validate the syntax of action scripts, create and modify action parameters, and
more.
4.Improved Debugger Pane Design and Functionality
The Debug Viewer pane has a new look, including icons to help us identify the type of information
displayed.
The Watch tab and Variable tab now display the types of expressions or variables, in addition to their
names and values.
The Command tab now displays the command history (in read-only format) in addition to the command
line, enabling us to view previously-run commands and select commands to reuse.
In addition, a right-click context menu in the Command tab enables us to:
copy from the command history and edit the command line using the clipboard.
clear the command history.
5.New Object Identification Solutions in Maintenance Run Mode
In addition to helping us update the steps and object repositories when objects in the application
change, the Maintenance Run Wizard can now help to solve the following problems:
The step failed because the object in the test is missing from the action's associated object repositories.
The object in the step exists in the application, but can be identified only through Smart Identification.
6.Additional Configuration Settings for Text Recognition Mechanism
We can now set all text recognition configuration settings from the QuickTest Options Dialog Box (Tools
> Options > General > Text Recognition), including new options for selecting the text block mode and
specifying the languages to be used with the OCR mechanism. This makes it easier to make any
necessary adjustments and to optimize the way that QuickTest identifies text in the application.
7.New Look for Options, Settings, and File Dialog Boxes
8.QuickTest Toolbar Customization Options
We can use the new Customize Dialog box (Tools > Customize) to customize the appearance of existing
menus and toolbars, and to create our own user-defined menus, toolbar buttons, and shortcuts.
We can also add new commands to the QuickTest Tools menu so that we can launch an application
directly from the menu. For example, we can use this option to create a shortcut to the application we
want to test or to an automation script.
9.Improved Web Extensibility
10. .NET Add-in and Extensibility Improvements
11.New Terminal Emulator Configuration Validation
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 5:01 AM 1
comments
Friday, March 19, 2010
Good Websites
Good websites to know more knowledge on Banking domain and Insurance Domain
http://www.howbankswork.com/
http://www.irdaindia.org/
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:09 AM 0
comments
Tuesday, March 9, 2010
QTP File Extensions
Resource.mtr-------- contain the resources associated information like function library, recovery,
shared repository
Launch QTP using a .vbs file and not the QTP desktop icon. You will notice a substantial increase
in speed.
For large tests, always define variables; function in an external .vbs file and not inside a reusable
action. Attach these files with your test scripts.
If you define a variable or a function in an action, on every iteration of your test run, memory
(RAM) will be allocated to those variables/functions and would not be released. Now as your
script starts consuming more and more RAM, your System Under Test (SUT) will tend to become
slower.
While running, QTP consumes a lot of memory by itself. It is always advisable to have lots of
available RAM (much more than what is recommended by HP) and good processor speed on a
system where you intend to install QTP.
When you have tests (and hence QTP) running for a prolonged period if time, there are chances
of memory leaks. To avoid memory leakages always restart QTP at some intervals of time. Using
AOM you can automate this process. [If you want to go into details of effect of RAM on speed of
computer read the post on RAM, Memory Usage thoroughly]
Avoid using hard coded wait(x) statement. Wait statement waits for full x seconds, even if the
event has already occurred. Instead use .sync or exist statement. While using exists statement
always has a value inside it.
For ex: .Exist(10) Here QTP will wait max till 10 seconds and if it finds the object at (say) 3 secs ,
it will resume the execution immediately thereby saving your precious time. On the other hand
if you leave the parenthesis blank, QTP would wait for object synchronization timeout you have
mentioned under File > Test Settings > Run Tab.
Make full use of what HP-QTP has provided you in the tool IDE. Use Automatically Generate
With statements after recording option present under Tools > Options > General Tab. This
will not only make your code look neater but also make your scripts perform better.
Make your own judgment whether you want to go for Descriptive Programming or Object
Repository or mixed approach. Each approach has it own pros and cons that in turn is related to
QTP performance.
Unless absolutely required, uncheck the options Save still image capture to results and Save
movie to results present under Tools > Options > Run tab. These options definitely have some
bearing on QTP run time performance.
Make the Run Mode as fast. This setting is present under Tool > Options > Run tab. Note: If
you intend to run your scripts from QC no need to worry about this option, as the scripts WILL
run in fast mode whether you want or not.
Make use of relative paths while calling reusable actions in your script. Using relative path would
make your script portable and easy to manage. I will cover in detail how tos and whys of using
relative paths in my next post.
Exploratory Testing:
An interactive process of simultaneous learning, test design, and test execution. - James Bach
A style of software testing that emphasizes the personal freedom and responsibility of the individual
tester to continualy optimize the value of his or her work by treating test-related learning, test design,
test execution and test results interpretation as mutually supportive activities that run in parallel
throughout the project. - Cem Kaner
Heuristic Testing - An approach to test design that employs heuristics to enable rapid development of
test cases. - James Bach
Risk-Based Testing - Any testing organized to explore specific product risks. - James Bach
Test Design - The process of creating tests. - James Bach
Test Execution - The process of configuring, operating, and observing a product for the purpose of
evaluating it. - James Bach
Test Logistics - The set of ideas that guide how resources are applied to fulfill the test strategy. - James
Bach
Test Strategy - The set of ideas that guide test design. - James Bach
Software Performance Testing - An empirical technical investigation conducted to provide stakeholders
with information about the quality of the product or service under test with regard to speed, scalability
and/or stability characteristics. - Scott Barber
Software Performance Investigation - A deliberate data-collection and data-interpretation activity
typically focused on data related to speed, scalability, and/or stability of the product under test. The
collected data are primarilly used to assess hypotheses about the root cause of one or more observed
performance issues. - Scott Barber
Software Performance Validation - A deliberate activity that compares speed, scalability and/or stability
characteristics of the product under test to the expectations of representative users of the product. Scott Barber
Software Performance Requirements - Performance related characteristics of the product under test
that must be met in order for the product to be released. Performance requirements are mandated via
legal contract or service level agreement. - Scott Barber
Software Performance Goals - Performance related characteristics of the product under test that are
desired to be met prior to product release, but which are not strictly mandatory. - Scott Barber
Application Usage Profile - One or more descriptions of how the product under test is, or is anticipated
to be, used during production operations. Usage profiles are typically expressed in terms of business
activities and usage scenarios. - Scott Barber
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:18 AM 0
comments
Monday, December 14, 2009
Project Testing CheckList
Testing Project Checklists
1. Project Initiation
a. Prepare System Test Estimates
b. Define System Test Approach
c. Define Testing Scope
d. Prepare DRAFT System Test Plan
e. Review System Test Plan
f. Prepare Test Schedule
g. Request Test Resources
h. Request Business Expert
i. Request Management Support
j. Request Environment/Technical Support
k. Request Test Hardware (pcs & servers)
l. Request Facilities (desks, chairs etc.)
m. Setup Test Project Folder
n. Revise Test Estimates
o. Define Entrance/Acceptance Criteria
p. Agree Communication Channels
q. Agree Reporting Procedures, Method & Frequency
r. Define Exit Criteria
s. Design Release Notes Template
2. Test Preparation
a. Agree Builds/Drops Schedule & Contents
b. Agree Release Notes Contents & Format
c. Agree Error Management Procedures
d. Define & Agree Error Management Roles
e. Define System Test Roles & Responsibilities
f. Assign Test Roles & Responsibilities
g. Assign Test Case Preparation Primary Responsibilities
h. Assign Test Case Preparation Secondary Responsibilities
We can use this programming to recognized similar type of objects. in this code the properties of the
objects is used in the script only. , no need to depend on the object repository.
Example:1Login into Flight Application
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "venkat"
Dialog("text:=Login").WinEdit("attached text:=Password:").Set "mercury"
Dialog("text:=Login").WinButton("text:=OK").Click
Example : 2--- Login into yahoo , click inbox , select a mail and delete
with Browser("CreationTime:=0").page("micclass:=Page")
.WebEdit("name:=login").Set "venkat"
.WebEdit("name:=passwd").Set "12345678"
.webbutton("name:=Sign In").Click
.link("text:=inbox\s\(\d*\)").Click
.WebCheckbox("index:=2").Set "ON"
.WebButton("name:=Delete","index:=0").Click
.link("text:=Sign Out").Click
End with
Example : 3--- Display the List of links in Google home page
Dim d
Set d=Description.Create
d("micclass").value="Link"
set a=Browser("CreationTime:=0").page("micclass:=Page").ChildObjects(d)
For i=0 to a.count-1
print a(i).getROProperty("innertext")
Next
Example : 4Display the data from all the edit boxes in Flight application
Dim d
Set d=Description.Create
d("micclass").value="WinEdit"
Set a=Window("text:=Flight Reservation").ChildObjects(d)
For i=0 to a.count-1
print a(i).getROproperty("attached text")&" "&a(i).getROProperty("text")
Next
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:05 AM 3
comments
QTP Cert Questions
HP QTP CERTIFICATION
Q: 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
Q: 2 What are the categories in the Step Generator?
Q: 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
Q: 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
Q: 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
Q: 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
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
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 Next 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
Q: 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
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
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
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
59 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
60 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 Object 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.
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 3:51 AM 1
comments
Testing Metrics
Metrics used in Software Testing
Metric is a measurement of unit for calculating the Quality of project, process..etc
Metric is calculated using the formula
Below are few of the metrics
Test Coverage = Number of units (KLOC/FP) tested / total size of the system. (LOC represents Lines of
Code)
Number of tests per unit size = Number of test cases per KLOC/FP (LOC represents Lines of Code).
Acceptance criteria tested = Acceptance criteria tested / total acceptance criteria
Defects per size = Defects detected / system size
Test cost (in %) = Cost of testing / total cost *100
Cost to locate defect = Cost of testing / the number of defects located
Achieving Budget = Actual cost of testing / Budgeted cost of testing
Defects detected in testing = Defects detected in testing / total system defects
Defects detected in production = Defects detected in production/system size
Quality of Testing = No of defects found during Testing/(No of defects found during testing + No of
acceptance defects found after delivery) *100
Effectiveness of testing to business = Loss due to problems / total resources processed by the system.
System complaints = Number of third party complaints / number of transactions processed
Scale of Ten = Assessment of testing by giving rating in scale of 1 to 10
Source Code Analysis = Number of source code statements changed / total number of tests.
Effort Productivity = Test Planning Productivity = No of Test cases designed / Actual Effort for Design
and Documentation
Test Execution Productivity = No of Test cycles executed / Actual Effort for testing
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 3:03 AM 0
comments
Monday, November 23, 2009
QC FAQs
1. what are the components in QC
Features:
Record and playback
Intelligent field selection will use IDs, names, or XPath as needed
Auto complete for all common Selenium commands
Although Selenium-IDE is a Firefox only add-on, tests created in it can also be run against other browsers
by using Selenium-RC and specifying the name of the test suite on the command line.
Selenium-RC (Remote Control)
Selenium-RC allows the test automation developer to use a programming language for maximum
flexibility and extensibility in developing test logic. For instance, if the application under test returns a
result set, and if the automated test program needs to run tests on each element in the result set, the
programming languages iteration support can be used to iterate through the result set, calling Selenium
commands to run tests on each item.
Selenium-RC provides an API (Application Programming Interface) and library for each of its supported
languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. This ability to use Selenium-RC with a high-level
programming language to develop test cases also allows the automated testing to be integrated with a
projects automated build environment.
Selenium-Grid
Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test suites that must be
run in multiple environments. With Selenium-Grid multiple instances of Selenium-RC are running on
various operating system and browser configurations, each of these when launching register with a hub.
When tests are sent to the hub they are then redirected to an available Selenium-RC, which will launch
the browser and run the test. This allows for running tests in parallel, with the entire test suite
theoretically taking only as long to run as the longest individual test.
* Tests developed on Firefox via Selenium-IDE can be executed on any other supported browser via a
simple Selenium-RC command line.
** Selenium-RC server can start any executable, but depending on browser security settings, there may
be technical limitations that would limit certain features.
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 1:21 AM 0
comments
Thursday, November 19, 2009
Defect /Bug Life Cycle
Defect / Bug
A computer bug is an error, flaw, mistake, failure, or fault in a computer program that prevents it from
working correctly or produces an incorrect result. Bugs arise from mistakes and errors, made by people,
in either a programs source code or its design.
Defect / Bug / Incident / Issue: The meaning for these words is same; any functionality not working as
per requirements.
Error: Any mistake in the program is an error; the error can be caused because of Syntax / Logical Error /
Runtime Error.
Failure: If the application / software is not satisfying the customer need it is failure product.
Life cycle of Bug:
Report New Defect: When any functionality is not working as per requirement the tester can report a
defect to developers
The Defect Report has the fields like DefectID, Summary, Detected By, Date Found, Assigned To,
Severity, Module, Build Ver, Priority, Status, Reproducible, Fixed By, Environment, Expected Result,
Actual Result, Comments
Following are various stages of bug life cycle. The status caption may vary depending on the bug tracking
system you are using.
1) New: When a Tester files new Defect.
2) Deferred / Postponed: If the bug is not related to current build or can not be fixed in this release or
bug is not important to fix immediately then the project manager can set the bug status as deferred
3) Resolved/Fixed: When developer makes necessary code changes and verifies the changes then
he/she can make bug status as Fixed and the bug is passed to testing team.
4) Could not reproduce: If developer is not able to reproduce the bug by the steps given in bug report
by QA then developer can mark the bug as CNR. QA needs action to check if bug is reproduced and can
assign to developer with detailed reproducing steps.
5) Need more information: If developer is not clear about the bug reproduce steps provided by QA to
reproduce the bug, then he/she can mark it as Need more information. In this case QA needs to add
detailed reproducing steps and assign bug back to dev for fix.
6) Rejected/Invalid: Some times developer or team lead can mark the bug as Rejected or invalid if the
system is working according to specifications and bug is just due to some misinterpretation.
7) Reopen: If QA is not satisfy with the fix and if bug is still reproducible even after fix then QA can mark
it as Reopen so that developer can take appropriate action.
8) Closed: If bug is verified by the QA team and if the fix is ok and problem is solved then QA can mark
bug as Closed.
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 4:05 AM 0
comments
'''Script to open excel file ,which is read and write protected write data
'''''pwd1 is for read protected pwd2 is for write protected
Set xl=CreateObject("Excel.Application")
Set wb=xl.Workbooks.Open("e:\data2.xls",0,False,5,"pwd1","pwd2")
xl.DisplayAlerts=False
Set ws=wb.Worksheets("sheet1")
ws.cells(1,2)="hello"
ws.cells(2,2)="new data"
wb.Save
wb.Close
Set xl=nothing
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 1:56 AM 0
comments
Monday, November 16, 2009
Automation Plan
Below are the contents of Automation Test Plan
Content
Introduction
In Scope for Automation
Out of Scope
Automation Approach
Assumptions
Automation Tool
Framework
Schedules
Deliverables
Risks & Mitigation Plan
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 1:36 AM 0
comments
Sunday, November 15, 2009
Manual FAQs
What are the phases in SDLC
What are the Testing methodologies ( whitebox, blackbox, graybox)
What is Difference between SDLC and STLC
What is usecase.
What is project and product Testing
What is Verification and validation
What is traceability Matrix.
What is stub and Driver and in which approach these are used.
What are the types of testing for webapplication testing.
What is unit testing / Component testing
What is System Testing
what is Entry and Exit criteria
What are the test delivarables
what is Test Data
What are the fields in the TestCase
what is functional and non functional testing
what is static and dynamic testing
How to perform sanity testing
what is retesting and regresssion testing
what is exploratory testing
what is load and stress testing
what is soak testing
what is memory leakage testing
How do you test cookies
STLC
STLC
Software Testing Life Cycle has the below phases in execution of Testing a project
Analysis & Planning
During this phase Analyze the project testing is manual / Automation testing, Identify the budget,
Resource required, Types of Testing Required. Also discuss with Business Analyst, Project manager,
Business users and understand the Development Schedule, Project Build Release dates, Project Release
dates. Forming the Testing Team.
In this phase Test Lead / Manager has to decide what are in scope for testing, Estimations, Budge,
Schedules, Type of Testing to be conducted, Identify the deliverables, Approach.
During this phase preparation of high level test plan- is designed to prescribe the scope, approach,
resources, and schedule of all testing activities. The plan must identify the items to be tested, Items not
to be tested, the types of testing to be performed, the team responsible for testing, the resources and
schedule required to complete testing, and the risks associated with the plan.). All the above details are
included in the STP.
Test Design
After Test Plan is prepared / During the Plan KT sessions are also conducted to the Testing Team
members to understand the Project Requirements / Functionalities. After understanding the
Requirements Test Cases were developed for Functional testing / System Testing. The Test Case should
have the Details like TestCaseID, Priority, Test Name, Steps, Description, Expected Results, Actual Results
and Status
Test Cases are designed for
Sanity Test Cases
Functional Test Cases
Regression Test Cases
Negative Test Cases
It the project is Automation Test Scripts are developed for the existing Test Cases /Functionalities
Test Execution
The application is validated for the Test cases and check the application is working as per Requirements.
To execute the application Test Setup is prepared with the required Environment and the application is
tested with Different Test Data.
Reporting & Tracking
Report any Defects to the Development team if any functionality is not working as per the
Requirements.
The defect Report should have details
Defect ID, Summary, Detected By, Date, Assigned To, Severity, Priority, Status, Module, Build Ver,
Environment, Reproducible, Expected, Actual, Comments
Test Closure
After Testing is completed plan for Test Closure based on if no new defects are found, No risk in the
project, all the functionalities are tested and all the defects are closed
During this phase Project Manager / Business Analyst should be responsible to discuss with the Stake
Holders (Business users) and find out the requirements for the project
Following are the Different Categories of Requirements
Customer Requirements
Functional Requirements
Non-functional Requirements
Performance Requirements
Design Requirements
Derived Requirements
Allocated Requirements
Design
In systems design functions and operations are described in detail, including screen layouts, business
rules, process diagrams and other documentation. The output of this stage will describe the new system
as a collection of modules or subsystems.
The design stage takes as its initial input the requirements identified in the approved requirements
document. For each requirement, a set of one or more design elements will be produced as a result of
interviews, workshops, and/or prototype efforts. Design elements describe the desired software
features in detail, and generally include functional hierarchy diagrams, screen layout diagrams, tables of
business rules, business process diagrams, pseudocode, and a complete entity-relationship diagram with
a full data dictionary. These design elements are intended to describe the software in sufficient detail
that skilled programmers may develop the software with minimal additional input.
Build or coding
Modular and subsystem programming code will be accomplished during this stage. Unit testing and
module testing are done in this stage by the developers. This stage is intermingled with the next in that
individual modules will need testing before integration to the main project. Code will be test in every
section.
Testing
The code is tested at various levels in software testing. Unit, system and user acceptance testing are
often performed. This is a grey area as many different opinions exist as to what the stages of testing are
and how much if any iteration occurs. Iteration is not generally part of the waterfall model, but usually
some occurs at this stage.
Types of testing:
Data set testing.
Unit testing
System testing
Integration testing
Black box testing
White box testing
Module testing
Regression testing
Automation testing
This testing is conducted based on knowledge of the internal logic of an applications code. This is also
known as Glass box Testing / Open Box Testing / Clear Box Testing. The testers should know the internal
code of the application. Tests are based on coverage of code statements, branches, paths, conditions.
Unit testing:
Testing is conducted on individual components or modules. This test is conducted by the Developers or
whiterbox testers,as this requires detailed knowledge of the internal program design and code.
Integration testing:
Testing is conducted by 2 or more modules / systems to verify combined functionality after integration.
Modules are typically code modules, individual applications, client and server applications on a network,
etc. This type of testing is especially relevant to client/server and distributed systems.
Incremental integration testing:
Testing is conducted in Bottom up approach; continuous testing of an application as new functionalities
are added; Application functionalities and modules should be independent enough to test separately.
Black box testing:
Testing the application without not considered about the internal design of the system.Testing is
conducted based on requirements and functionality.
Functional testing:
This type of testing is conducted to ensure the application is working as per the business requirements
and the internal logic of the code is ignored.This type of test is conducted as part of blackbox testing
System testing:
The Entire system is tested as per the Business requirements. Black-box type testing that is based on
complete requirement specifications, covers all combined parts of a system.
End-to-end testing:
Similar to system testing,testing is conducted on the complete application environment in a situation
that resembles like application used in production, such as interacting with a database, using network
communications, or interacting with other hardware, applications, or systems if appropriate.
Sanity testing:
Testing to determine if the new build is stable, all the major functionalities are working correct. usually
conducted as First test when ever the build is released. During this test all the major functionalities are
tested.if any major functionality fails and if showstopper the testing is stoped and reported to
development as serious issue.
Regression testing:
Testing the application as a whole for the changes done in the application. Test is conducted to ensure
the changes are working correct and because of these changes unchanged code is not affected.
ReTesting:
The the application functionality once again with different type of input data to validate the
functionalities as per the requirements.
Acceptance testing:
This type of testing is done to verify the system meets the customer specified requirements. Business
Users or customer do this testing to determine whether to accept application.
Performance testing:
Test is conducted the check the peformance of the system to complete the transaction, performance of
the system can the checked by conducting Load, Stress, Volume,Soak testing..
Load testing:
It is a performance testing to check system behavior under load.This test is conducted by increasing the
load on the system and check the performance.
Stress testing:
System is stressed beyond its specifications to check how and when it fails. Performed under heavy load
like putting large number beyond storage capacity, complex database queries, continuous input to
system or database load.
Volume Testing:
This test is conducted by increasing the volume of data for processing and check the Performance.
soak Testing:
check the performance of the application by continiously accessing the application for more number of
hours.
Usability testing:
This is to check the User-friendliness of the application. The flow of the application is tested and check
new user can understand the application easily, Proper help documented are provided. The application
is easy to use, look and feel and navigations are simple to understand..etc
Concurrent Testing:
Check the behaviour of the application when multiple users access the same functionality of the
application at the same time.
Exploratory Testing:
This testing is an approach to software testing that is concisely described as simultaneous learning, test
design and test execution.Exploratory testing has always been performed by skilled testers.Exploratory
testing is particularly suitable if requirements and specifications are incomplete, or if there is lack of
time. The approach can also be used to verify that previous testing has found the most important
defects. It is common to perform a combination of exploratory and scripted testing where the choice is
based on risk
Adhoc Testing:
Ad hoc testing is a commonly used term for software testing performed without planning and
documentation.The tests are intended to be run only once, unless a defect is discovered. Ad hoc testing
is a part of exploratory testing, being the least formal of test methods
Install/uninstall testing:
This test is conducted for full, partial, or upgrade install/uninstall processes on different operating
systems under different hardware, software environment.This test is conducted to ensure after install
/uninstall of the application the existing sytem is not affected like performance, affecting other
softwares..etc
Recovery testing:
check wheather the system can recover the data from failures.Security testing Can system be
penetrated by any hacking way. Testing how well the system protects against unauthorized internal or
external access. Checked if system, database is safe from external attacks.
Compatibility testing:
Testing is conducted to check the application works on different platforms / different browsers /
different versions of browser (for web application). Test is also conducted to check the backward and
forward comaptibility
Alpha testing:
In house Testing environment is created for this type of testing. Testing is done at the end of
development by the Business users. Still minor design changes may be made as a result of testing status.
Beta testing :
Testing typically done by end-users or others. Final testing before releasing application for commercial
purpose.
I18N Testing:
Testing the application for different international languages, check the application testing is successfull
for the following items
help information
images
code templates
collation
examples
Localization Testing
Localization is the process of adapting a globalized application to a
particular culture/locale. The following needs to be considered in localization testing:
Things that are often altered during localization, such as the UserInterface and content files.
Operating System
Keyboards
Text Filters
Hot keys
Spelling Rules
Sorting Rules
Printers
Size of Papers
Mouse
Date formats
Memory Availability
Voice
Video Content
destination user can talk n hear properly.10.If any one of them closes the session, again a tone must be
heard at the other end.11.Close of session in between
=========================================
TestCases for Coffee Vending machine
========================================
check the vending machine has options to select coffee, tea, milkcheck insert coin is workingcheck after
insert coin only coffee / tea / milk can be takencheck if invalid coin is inserted will not workcheck if extra
amount is inserted balance is returnedinsert coinpress coffee buttonin the middle switch off the
machinecheck weather the coffee comes or not.
insert coinpress coffee buttonwhile coffee is pouring downpress other flavour buttoncheck wheather
you get the same flavour selected first or the flavour selected second.
=========================================
Testcase for mobile phone
=========================================
1.Check whether the dimensions of mobile are according to the requirements.2.Check whether the
colour is accroding to requirments.3.Check whether the functionalities are with respect to the
requirements.4.Check whether the backup for battery is as given in the manual.5.Check whether the
functionalities are with respect to the manual.(extras,games,email services,bluetooth,camera
etc.)6.Checking for various items as charger,headphones,cable etc.7.checking for display colour(B/w or
colour) of the mobile as mentioned in requirements.8.check whether the functionality of keys are
proper.9.check whether the model is according to the requirements.10.check for memory used for
storage.11.checking out for memory where data is stored above the peak value.12.checking for proper
signal and network in maximum areas.13.checking for performance of the mobile.14.checking for the
usability.
==========================================
TestCases for login Functionality of any application
==========================================
1. login with valid username and password2. login without username3. login without password4. login
with invalid username5. login wiht invalid password
==========================================
End If
Next
========================================
'''''Function to send a mail
========================================
Function SendMail(SendTo, Subject, Body, Attachment)
Set otl=CreateObject("Outlook.Application")
Set m=otl.CreateItem(0)
m.to=SendTo
m.Subject=Subject
m.Body=Body
If (Attachment <> "") Then
Mail.Attachments.Add(Attachment)
End If
m.Send
otl.Quit
Set m = Nothing
Set otl = Nothing
End Function
Call SendMail("venkatadrin.g@gmail.com","hi","This is test mail for tsting","")
================================================
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 8:05 PM 0
comments
WSH
Windows Script Host (WSH) is a Windows administration tool.
WSH creates an environment for hosting scripts. That is, when a script arrives at your computer, WSH
plays the part of the host it makes objects and services available for the script and provides a set of
guidelines within which the script is executed. Among other things, Windows Script Host manages
security and invokes the appropriate script engine.
WSH is language-independent for WSH-compliant scripting engines. It brings simple, powerful, and
flexible scripting to the Windows platform, allowing you to run scripts from both the Windows desktop
and the command prompt.
Windows Script Host is ideal for noninteractive scripting needs, such as logon scripting, administrative
scripting, and machine automation.
WSH Objects and Services
Windows Script Host provides several objects for direct manipulation of script execution, as well as
helper functions for other actions. Using these objects and services, you can accomplish tasks such as
the following:
Print messages to the screen
Connect to printers
Wscript :
Sink events
Output information to the default output device (for example, a dialog box or the command
line)
WshArguments
WshNamed
WshUnnamed
WshNetwork
WshController
WshRemote
WshRemote
Error Access the error information available when a remote script (a WshRemote object)
terminates as a result of a script error
WshShell
Create a shortcut
Access a system folder Manipulate environment variables (such as WINDIR, PATH, or PROMPT)
WshShortcut
WshSpecialfolders
WshURLShortcut
WshEnvironment
Access any of the environment variables (such as WINDIR, PATH, or PROMPT) WshScriptExec
Determine status and error information about a script run with Exec()
===============================================
Set obj=CreateObject("WScript.NetWork")
str="User Name is " & obj.UserName str=str&"Computer Name is " &
obj.ComputerNamestr=str&"Domain Name is " & obj.UserDomainMsgBox strSet obj=Nothing
==============================================='
'''''Run notepad.exe and send ALT+F4 key which will close nodepad
Set obj=CreateObject("WScript.Shell")
obj.Run "notepad.exe"
wait(5)
obj.SendKeys "%{F4}"
==============================================
set ws = CreateObject("WScript.Shell")
ws.Run "calc"
wait(2)
ws.SendKeys "1{+}"
wait(2)
ws.SendKeys "2"
wait(2)
ws.SendKeys "~"
wait(2)
ws.SendKeys "*3"
wait(2)
ws.SendKeys "~"
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 12:43 AM 0
comments
Saturday, November 7, 2009
WMI
Purpose
Windows Management Instrumentation (WMI) is the infrastructure for management data and
operations on Windows-based operating
systems. we can write WMI scripts or applications to automate administrative tasks on remote
computers and WMI also supplies
management data to other parts of the operating system and products.
Starting WMI Service
WMI runs as a service with the display name "Windows Management Instrumentation" and the service
name "winmgmt". WMI runs
automatically at system startup under the LocalSystem account. If WMI is not running, it automatically
starts when the first
management application or script requests connection to a WMI namespace.
======================================================
''''''Display the list of namespaces in WMI service
======================================================
strComputer = "."
Set ms = GetObject("winmgmts:\\" & strComputer & "\root")
Set ns=ms.InstancesOf("__NAMESPACE")
For Each n In ns
print n.Name
Next
================================================='
''Display the list of classes in cimv2 names space
=================================================
strComputer = "."
Set ms =GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set clss = ms.SubclassesOf()
For Each c In clss
print c.Path_.PathNext
================================================
The Win32_Process class defines the following methods.
AttachDebugger : Launches the currently registered debugger for a process.
Create : Creates a new process.
GetOwner : Retrieves the user name and domain name under which the process is running.
GetOwnerSid : Retrieves the security identifier (SID) for the owner of a process.
SetPriority : Changes the execution priority of a process.
Terminate : Terminates a process and all of its threads.
=============================================
''''''''Create a notepad application
=============================================
strComputer = "."
Set fs=nothing
=====================================================
'''''''''''''''read data from a text file
=====================================================
Dim fs,f
Set fs=CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile("e:\file1.txt",1)
While f.AtEndOfLine<>True
msgbox f.ReadLine
Wend
f.Close
Set fs=nothing
=====================================================
''''''''''create a new excel file and write data
=====================================================
Dim xl,wb,ws
Set xl=CreateObject("Excel.Application")
Set wb=xl.Workbooks.Add
Set ws=wb.Worksheets("sheet1")
ws.cells(1,1)=10
ws.cells(2,1)=20
ws.cells(3,1)=50
wb.SaveAs "e:\file1.xls"
wb.Close
Set xl=nothing
=====================================================
'''''''open existing file and write data in second column in Sheet1
=====================================================
Dim xl,wb,ws
Set xl=CreateObject("Excel.Application")
Set wb=xl.Workbooks.Open("e:\file1.xls")
Set ws=wb.Worksheets("sheet1")
ws.cells(1,2)="mindq"
ws.cells(2,2)="hyd"
ws.cells(3,2)="ap"
wb.Save
wb.Close
Set xl=nothing
=====================================================
'''''''''''read data from excel from rows and columns
=====================================================
Dim xl,wb,ws
Set xl=CreateObject("Excel.Application")
Set wb=xl.Workbooks.Open("e:\file1.xls")
Set ws=wb.Worksheets("sheet1")
r=ws.usedrange.rows.count
c=ws.usedrange.columns.count
For i=1 to r
v=""
For j=1 to c
v=v&" "& ws.cells(i,j)
Next
print v
print "-----------------------"
Next
wb.Close
Set xl=nothing
======================================================
''''''''''''''''get the bgcolor in a cell in excel
======================================================
Dim xl,wb,ws
Set xl=CreateObject("Excel.Application")
Set wb=xl.Workbooks.Open("e:\file3.xls")
Set ws=wb.Worksheets("sheet1")
r=ws.usedrange.rows.count
c=ws.usedrange.columns.count
For i=1 to r
For j=1 to c
x=ws.cells(i,j).interior.colorindex
msgbox x
Next
Next
wb.Close
Set xl=nothing
======================================================='
'''''''''''''''''''''create word and write data
=======================================================
dim mw
set mw=CreateObject("Word.Application")
mw.Documents.Add
mw.selection.typetext "hello"
mw.ActiveDocument.SaveAs "e:\file1.doc"
mw.quit
set mw=nothing
=======================================================
''''''''''script will display all the doc files in all the drives in the system
========================================================
Dim mw
Set mw=CreateObject("Word.Application")
Set fs=createobject("Scripting.FileSystemObject")
Set d=fs.Drives
mw.FileSearch.FileName="*.doc"
For each dr in d
msgbox dr
mw.FileSearch.LookIn=dr
mw.FileSearch.SearchSubFolders=True
mw.FileSearch.Execute
For each i in mw.FileSearch.FoundFiles
print i
Set f=fs.GetFile(i)
print f.Name&" "&f.Size&" "&f.DateCreated
print "-------------------------------------------------------------------"
Next
Next
mw.Quit
==========================================================
'''''''''Open Internet Explorer and navigate to yahoomail
==========================================================
Dim ie
Set ie=CreateObject("InternetExplorer.Application")
ie.Visible=True
ie.Navigate "www.yahoomail.com"
x=Browser("CreationTime:=0").GetROProperty("title")
msgbox x
==========================================================
''''''Create word, Create table and write all the services names
==========================================================
Set mw = CreateObject("Word.Application")
mw.Visible = True
Set dc = mw.Documents.Add()
Set objRange = dc.Range()
dc.Tables.Add
objRange,1,3
Set objTable = dc.Tables(1)
x=1
strComputer = "."
UNIX. However, knowledge of UNIX is required for operations which aren't covered by a graphical
program, or for when there is no X windows system, for example, in a telnet session.
The UNIX operating system
The UNIX operating system is made up of three parts; the kernel, the shell and the programs.
The kernel
The kernel of UNIX is the hub of the operating system: it allocates time and memory to programs and
handles the filestore and communications in response to system calls.
As an illustration of the way that the shell and the kernel work together, suppose a user types rm myfile
(which has the effect of removing the file myfile). The shell searches the filestore for the file containing
the program rm, and then requests the kernel, through system calls, to execute the program rm on
myfile. When the process rm myfile has finished running, the shell then returns the UNIX prompt % to
the user, indicating that it is waiting for further commands.
The shell
The shell acts as an interface between the user and the kernel. When a user logs in, the login program
checks the username and password, and then starts another program called the shell. The shell is a
command line interpreter (CLI). It interprets the commands the user types in and arranges for them to
be carried out. The commands are themselves programs: when they terminate, the shell gives the user
another prompt (% on our systems).
The adept user can customise his/her own shell, and users can use different shells on the same machine.
Staff and students in the school have the tcsh shell by default.
The tcsh shell has certain features to help the user inputting commands.
Filename Completion - By typing part of the name of a command, filename or directory and pressing the
[Tab] key, the tcsh shell will complete the rest of the name automatically. If the shell finds more than
one name beginning with those letters you have typed, it will beep, prompting you to type a few more
letters before pressing the tab key again.
History - The shell keeps a list of the commands you have typed in. If you need to repeat a command,
use the cursor keys to scroll up and down the list or type history for a list of previous commands.
Files and processes
Everything in UNIX is either a file or a process.
A process is an executing program identified by a unique PID (process identifier).
A file is a collection of data. They are created by users using text editors, running compilers etc.
Examples of files:
a document (report, essay etc.)
the text of a program written in some high-level programming language
instructions comprehensible directly to the machine and incomprehensible to a casual user, for
example, a collection of binary digits (an executable or binary file);
a directory, containing information about its contents, which may be a mixture of other directories
(subdirectories) and ordinary files.
The Directory Structure
All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical
structure, like an inverted tree. The top of the hierarchy is traditionally called root.
In the diagram above, we see that the directory ee51ab contains the subdirectory unixstuff and a file
proj.txt
Starting an Xterminal session
To start an Xterm session, click on the Xterminal icon at the bottom of your screen.
An Xterminal window will appear with a Unix prompt, waiting for you to start entering commands.
UNIX Tutorial One
1.1 Listing files and directories
ls (list)
When you first login, your current working directory is your home directory. Your home directory has
the same name as your user-name, for example, ee91ab, and it is where your personal files and
subdirectories are saved.
To find out what is in your home directory, type
% ls (short for list)
The ls command lists the contents of your current working directory.
There may be no files visible in your home directory, in which case, the UNIX prompt will be returned.
Alternatively, there may already be some files inserted by the System Administrator when your account
was created.
ls does not, in fact, cause all the files in your home directory to be listed, but only those ones whose
name does not begin with a dot (.) Files beginning with a dot (.) are known as hidden files and usually
contain important program configuration information. They are hidden because you should not change
them unless you are very familiar with UNIX!!!
To list all files in your home directory including those whose names begin with a dot, type
% ls -a
ls is an example of a command which can take options: -a is an example of an option. The options
change the behaviour of the command. There are online manual pages that tell you which options a
particular command can take, and how each option modifies the behaviour of the command. (See later
in this tutorial)
1.2 Making Directories
mkdir (make directory)
We will now make a subdirectory in your home directory to hold the files you will be creating and using
in the course of this tutorial. To make a subdirectory called unixstuff in your current working directory
type
% mkdir unixstuff
To see the directory you have just created, type
% ls
1.3 Changing to a different directory
cd (change directory)
The command cd directory means change the current working directory to 'directory'. The current
working directory may be thought of as the directory you are in, i.e. your current position in the filesystem tree.
To change to the directory you have just made, type
% cd unixstuff
cp (copy)
cp file1 file2 is the command which makes a copy of file1 in the current working directory and calls it
file2
What we are going to do now, is to take a file stored in an open access area of the file system, and use
the cp command to copy it to your unixstuff directory.
First, cd to your unixstuff directory.
% cd ~/unixstuff
Then at the UNIX prompt, type,
% cp /vol/examples/tutorial/science.txt .
(Note: Don't forget the dot (.) at the end. Remember, in UNIX, the dot means the current directory.)
The above command means copy the file science.txt to the current directory, keeping the name the
same.
(Note: The directory /vol/examples/tutorial/ is an area to which everyone in the department has read
and copy access. If you are from outside the University, you can grab a copy of the file here. Use
'File/Save As..' from the menu bar to save it into your unixstuff directory.)
Exercise 2a
Create a backup of your science.txt file by copying it to a file called science.bak
2.2 Moving files
mv (move)
mv file1 file2 moves (or renames) file1 to file2
To move a file from one place to another, use the mv command. This has the effect of moving rather
than copying the file, so you end up with only one file rather than two.
It can also be used to rename a file, by moving the file to the same directory, but giving it a different
name.
We are now going to move the file science.bak to your backup directory.
First, change directories to your unixstuff directory (can you remember how?). Then, inside the unixstuff
directory, type
% mv science.bak backups/.
Type ls and ls backups to see if it has worked.
2.3 Removing files and directories
rm (remove), rmdir (remove directory)
To delete (remove) a file, use the rm command. As an example, we are going to create a copy of the
science.txt file then delete it.
Inside your unixstuff directory, type
% cp science.txt tempfile.txt% ls (to check if it has created the file)% rm tempfile.txt % ls (to check if it
has deleted the file)
You can use the rmdir command to remove a directory (make sure it is empty first). Try to remove the
backups directory. You will not be able to since UNIX will not let you remove a non-empty directory.
Exercise 2b
Create a directory called tempstuff using mkdir , then remove it using the rmdir command.
word.
grep (don't ask why it is called grep)
grep is one of many standard UNIX utilities. It searches files for specified words or patterns. First clear
the screen, then type
% grep science science.txt
As you can see, grep has printed out each line containg the word science.
Or has it????
Try typing
% grep Science science.txt
The grep command is case sensitive; it distinguishes between Science and science.
To ignore upper/lower case distinctions, use the -i option, i.e. type
% grep -i science science.txt
To search for a phrase or pattern, you must enclose it in single quotes (the apostrophe symbol). For
example to search for spinning top, type
% grep -i 'spinning top' science.txt
Some of the other options of grep are:
-v display those lines that do NOT match -n precede each maching line with the line number -c print only
the total count of matched lines
Try some of them and see the different results. Don't forget, you can use more than one option at a
time, for example, the number of lines without the words science or Science is
% grep -ivc science science.txt
wc (word count)
A handy little utility is the wc command, short for word count. To do a word count on science.txt, type
% wc -w science.txt
To find out how many lines the file has, type
% wc -l science.txt
Summary
cp file1 file2
copy file1 and call it file2
mv file1 file2
move or rename file1 to file2
rm file
remove a file
rmdir directory
remove a directory
cat file
display a file
more file
display a file a page at a time
head file
You should now have two files. One contains six fruit, the other contains four fruit. We will now use the
cat command to join (concatenate) list1 and list2 into a new file called biglist. Type
% cat list1 list2 > biglist
What this is doing is reading the contents of list1 and list2 in turn, then outputing the text to the file
biglist
To read the contents of the new file, type
% cat biglist
3.3 Redirecting the Input
We use the < symbol to redirect the input of a command.
The command sort alphabetically or numerically sorts a list. Type
% sort
Then type in the names of some vegetables. Press [Return] after each one.
carrotbeetrootartichoke^D (control d to stop)
The output will be
artichokebeetroot carrot
Using < you can redirect the input to come from a file rather than the keyboard. For example, to sort the
list of fruit, type
% sort < biglist
and the sorted list will be output to the screen.
To output the sorted list to a file, type,
% sort <> slist
Use cat to read the contents of the file slist
3.4 Pipes
To see who is on the system with you, type
% who
One method to get a sorted list of names is to type,
% who > names.txt% sort < names.txt
This is a bit slow and you have to remember to remove the temporary file called names when you have
finished. What you really want to do is connect the output of the who command directly to the input of
the sort command. This is exactly what pipes do. The symbol for a pipe is the vertical bar
For example, typing
% who sort
will give the same result as above, but quicker and cleaner.
To find out how many users are logged on, type
% who wc -l
Exercise 3b
a2ps -Phockney textfile is the command to print a postscript file to the printer hockney.
Using pipes, print all lines of list1 and list2 containing the letter 'p', sort the result, and print to the
printer hockney.
Answer available here
Summary
command > file
to use that option, you are advised to rename the compiled file immediately, otherwise the next such
file will overwrite it and it will be lost.
4.3 Getting Help
On-line Manuals
There are on-line manuals which gives information about most commands. The manual pages tell you
which options a particular command can take, and how each option modifies the behaviour of the
command. Type man command to read the manual page for a particular command.
For example, to find out more about the wc (word count) command, type
% man wc
Alternatively
% whatis wc
gives a one-line description of the command, but omits any information about options etc.
Apropos
When you are not sure of the exact name of a command,
% apropos keyword
will give you the commands with keyword in their manual page header. For example, try typing
% apropos copy
Summary
*
match any number of characters
?
match one character
man command
read the online manual page for a command
whatis command
brief description of a command
apropos keyword
match commands with keyword in their man pages
UNIX Tutorial Five
5.1 File system security (access rights)
In your unixstuff directory, type
% ls -l (l for long listing!)
You will see that you now get lots of details about the contents of your directory, similar to the example
below.
Each file (and directory) has associated access rights, which may be found by typing ls -l. Also, ls -lg gives
additional information as to which group owns the file (beng95 in the following example):
-rwxrw-r-- 1 ee51ab beng95 2450 Sept29 11:52 file1
In the left-hand column is a 10 symbol string consisting of the symbols d, r, w, x, -, and, occasionally, s or
S. If d is present, it will be at the left hand end of the string, and indicates a directory: otherwise - will be
the starting symbol of the string.
The 9 remaining symbols indicate the permissions, or access rights, and are taken as three groups of 3.
The left group of 3 gives the file permissions for the user that owns the file (or directory) (ee51ab in the
above example);
the middle group gives the permissions for the group of people to whom the file (or directory) belongs
(eebeng95 in the above example);
the rightmost group gives the permissions for all others.
The symbols r, w, etc., have slightly different meanings depending on whether they refer to a simple file
or to a directory.
Access rights on files.
r (or -), indicates read permission (or otherwise), that is, the presence or absence of permission to read
and copy the file
w (or -), indicates write permission (or otherwise), that is, the permission (or otherwise) to change a file
x (or -), indicates execution permission (or otherwise), that is, the permission to execute a file, where
appropriate
Access rights on directories.
r allows users to list files in the directory;
w means that users may delete files from the directory or move files into it;
x means the right to access files in the directory. This implies that you may read files in the directory
provided you have read permission on the individual files.
So, in order to read a file, you must have execute permission on the directory containing that file, and
hence on any directory containing that directory as a subdirectory, and so on, up the tree.
Some examples
-rwxrwxrwx
a file that everyone can read, write and execute (and delete).
-rw------a file that only the owner can read and write - no-one else can read or write and no-one has execution
rights (e.g. your mailbox file).
5.2 Changing access rights
chmod (changing a file mode)
Only the owner of a file can use chmod to change the permissions of a file. The options of chmod are as
follows
Symbol
Meaning
u
user
g
group
o
other
a
all
r
read
w
% sleep 100
You can suspend the process running in the foreground by holding down the [control] key and typing [z]
(written as ^Z) Then to put it in the background, type
% bg
Note: do not background programs that require user interaction e.g. pine
5.4 Listing suspended and background processes
When a process is running, backgrounded or suspended, it will be entered onto a list along with a job
number. To examine this list, type
% jobs
An example of a job list could be
[1] Suspended sleep 100[2] Running netscape[3] Running nedit
To restart (foreground) a suspended processes, type
% fg %jobnumber
For example, to restart sleep 100, type
% fg %1
Typing fg with no job number foregrounds the last suspended process.
5.5 Killing a process
kill (terminate or signal a process)
It is sometimes necessary to kill a process (for example, when an executing program is in an infinite
loop)
To kill a job running in the foreground, type ^C (control c). For example, run
% sleep 100^C
To kill a suspended or background process, type
% kill %jobnumber
For example, run
% sleep 100 &% jobs
If it is job number 4, type
% kill %4
To check whether this has worked, examine the job list again to see if the process has been removed.
ps (process status)
Alternatively, processes can be killed by finding their process numbers (PIDs) and using kill PID_number
% sleep 100 &% ps
PID TT S TIME COMMAND20077 pts/5 S 0:05 sleep 10021563 pts/5 T 0:00 netscape21873 pts/5 S 0:25
nedit
To kill off the process sleep 100, type
% kill 20077
and then type ps again to see if it has been removed from the list.
If a process refuses to be killed, uses the -9 option, i.e. type
% kill -9 20077
Note: It is not possible to kill off other users' processes !!!
Summary
ls -lag
This will compress the file and place it in a file called science.txt.Z
To see the change in size, type ls -l again.
To uncomress the file, use the uncompress command.
% uncompress science.txt.Z
gzip
This also compresses a file, and is more efficient than compress. For example, to zip science.txt, type
% gzip science.txt
This will zip the file and place it in a file called science.txt.gz
To unzip the file, use the gunzip command.
% gunzip science.txt.gz
file
file classifies the named files according to the type of data they contain, for example ascii (text),
pictures, compressed data, etc.. To report on all files in your home directory, type
% file *
history
The C shell keeps an ordered list of all the commands that you have entered. Each command is given a
number according to the order it was entered.
% history (show command history list)
If you are using the C shell, you can use the exclamation character (!) to recall commands easily.
% !! (recall last command)
% !-3 (recall third most recent command)
% !5 (recall 5th command in list)
% !grep (recall last command starting with grep)
You can increase the size of the history buffer by typing
% set history=100
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 6:51 PM 0
comments
QTP10.00 New Features
New Features of QTP 10.00
1. Centrally Manage and Share Testing Assets, Dependencies, and Versions in Quality Center 10.00
In the earlier version of QC, the Test Assets like ( Repository, Library, Recoveries ) are placed in the
Attachments and if these assets are associated to the Test there is no dependencies information.
In QC 10.00 there is a new Section called Test Resources in the section we can place all the Assets and
associate these to the Test Script. The QC tool maintains the dependencies information between the
Assets and Test Script.
It also provides build in Version control; when the Test case/ scripts ..etc is checkout and checkin into QC
it will maintain a new version which is similar concept in VSS.
2. Perform Single-User Local System Monitoring While Running Your Tests
we can observe the performance of the local system when the script is executed. Like usage of memory,
GDI objects, Thread counters.
Bitmap Comparison.
If you need to further customize the way bitmaps are compared in checkpoints, you can develop custom
comparers that compare bitmaps according to your requirements. You develop a custom comparer as a
COM object and install and register it on the QuickTest computer. A QuickTest user can then choose to
use a custom comparer to perform the comparison in a bitmap checkpoint (on a per checkpoint basis).
Note : for more information on Customizing the Alogrithm Please Refer Help in QTP
6. Centrally Manage Your Work Items and ToDo Tasks in the To Do Pane
we can make a note of all the tasks to be perfomed in the TODO Pane
View menu--> To Do List
7. Improve Test Results Analysis with New Reporting Functionality
A. Export Results Report
The results can be exported to DOC, PDF files also apart from HTML.
In the Results window ; File menu--> Export Report
B. Reporter.ReportEvent
During the script execution for any failed steps we can capture the bitmap and display it in the results
window along with Reporter.ReportEvent method
Example:
If condition is falied then
Window(Flight Reservation).CaptureBitmap b1.bmp
Reporter.ReportEvent 1,Error,The error message in the window,b1.bmp
End if
C. Jumping to a Step in QuickTest
We can view the step in QuickTest that corresponds to a node in the run results tree.
To view the step in the test that corresponds to a node:
Select a node in the run results tree.
Perform one of the following:
Click the Jump to Step in QuickTest button from the Run Results toolbar.
Right-click and select Jump to Step in QuickTest from the context-sensitive menu.
Select View > Jump to Step in QuickTest.
The QuickTest window is activated and the step is highlighted.
8. Test Standard and Custom Delphi Objects Using the Delphi Add-in and Delphi Add-in Extensibility
We can use the QuickTest Professional Delphi Add-in to test objects in Delphi applications. We can
create and run tests and components on these objects, as well as check their properties. We create and
run tests and components on Delphi applications in much the same way as you do for other Windowsbased applications.
The Delphi Add-in provides test objects, methods, and properties that can be used when testing objects
in Delphi applications
Product Enhancements
1.Upgrade from QuickTest 9.5
If QuickTest 9.5 is installed on the computer, we can choose to upgrade to QuickTest version 10.00. This
enables us to continue using many of the configurations and options we have already set in QuickTest
9.5. We can also use an msi silent installation command line to upgrade from QuickTest 9.5.
2.Improved IntelliSense Functionality
QuickTest now provides full IntelliSense for the following types of objects:
Objects created by a step or function (for example, by calling the CreateObject method)
Variables to which an object is assigned
Reserved objects
COM objects
Properties that return objects
3.Added Control for Editing and Managing Actions in Automation Scripts
The QuickTest Professional Automation Object Model has a new set of objects and methods for
manipulating test actions and action parameters. We can now use automation scripts to create new
actions, modify and validate the syntax of action scripts, create and modify action parameters, and
more.
4.Improved Debugger Pane Design and Functionality
The Debug Viewer pane has a new look, including icons to help us identify the type of information
displayed.
The Watch tab and Variable tab now display the types of expressions or variables, in addition to their
names and values.
The Command tab now displays the command history (in read-only format) in addition to the command
line, enabling us to view previously-run commands and select commands to reuse.
In addition, a right-click context menu in the Command tab enables us to:
copy from the command history and edit the command line using the clipboard.
clear the command history.
5.New Object Identification Solutions in Maintenance Run Mode
In addition to helping us update the steps and object repositories when objects in the application
change, the Maintenance Run Wizard can now help to solve the following problems:
The step failed because the object in the test is missing from the action's associated object repositories.
The object in the step exists in the application, but can be identified only through Smart Identification.
6.Additional Configuration Settings for Text Recognition Mechanism
We can now set all text recognition configuration settings from the QuickTest Options Dialog Box (Tools
> Options > General > Text Recognition), including new options for selecting the text block mode and
specifying the languages to be used with the OCR mechanism. This makes it easier to make any
necessary adjustments and to optimize the way that QuickTest identifies text in the application.
7.New Look for Options, Settings, and File Dialog Boxes
The QuickTest Options and Settings dialog boxes have changed from their former tab-based design to a
more easily navigable tree-based structure. The tree contains only the options relevant for the add-ins
that are currently loaded.
8.QuickTest Toolbar Customization Options
We can use the new Customize Dialog box (Tools > Customize) to customize the appearance of existing
menus and toolbars, and to create our own user-defined menus, toolbar buttons, and shortcuts.
We can also add new commands to the QuickTest Tools menu so that we can launch an application
directly from the menu. For example, we can use this option to create a shortcut to the application we
want to test or to an automation script.
9.Improved Web Extensibility
QuickTest Professional Web Add-in Extensibility enables us to develop packages that provide high-level
support for third-party and custom Web controls that are not supported out-of-the-box by the Web
Add-in.
Limited extensibility support for the ASP .NET AJAX Control toolkit is provided with the extensibility
installation. We can use this package as an example for reference or as a basis for our own Ajax
extensibility packages.
By creating support for a Web control using Web Add-in Extensibility, we can direct QuickTest to
recognize the control as belonging to a specific test object class. We can also extend the list of available
test object classes that QuickTest is able to recognize and the list of operations that are available for
each class. This enables us to create tests that fully support the specific behavior of custom Web
controls.
The QuickTest Professional Web Add-in Extensibility SDK 10.00 offers the following improvements:
The Web Add-in Extensibility SDK now provides a global object, window, that we can use in the
JavaScript code to access the Internet Explorer global namespace. This enables us to access client-side
JavaScript objects and functions in the application we are testing.
We can now use the Microsoft Script Debugger or the Microsoft Visual Studio debugger to debug
JavaScript code that we write for Web Add-in Extensibility.
The LogLine method provided by the _util object can now (optionally) accept a numeric ID and a
numeric Category for the log entry that it passes to the event log. Users can later use this information to
filter log entries in the Event Viewer. In addition, the LogLine method can now accept string values for
the severity argument, in addition to numeric values.
10. .NET Add-in and Extensibility Improvements
The .NET Add-in provides the following new objects and methods:
The .NET Add-in now supports learning, recording, and running on .NET Windows Forms property grids.
QuickTest learns these controls using the new SwfPropertyGrid test object class.
The .NET Add-in has a new GetErrorProviderText method and ErrorProviderText identification property,
which is supported for all .NET Windows Forms test objects. We can use this method or property to
retrieve the tooltip text of the error icon associated with the object.
.NET Add-in Extensibility includes the following enhancements:
The C# and Visual Basic project templates and wizards provided with the .NET Add-in Extensibility SDK
installation are now provided on Microsoft Visual Studio 2008 (as well as on Microsoft Visual Studio .NET
and Microsoft Visual Studio 2005).
.NET Add-in Extensibility now enables users to create support for table checkpoints on custom .NET
Windows Forms table controls.
11.New Terminal Emulator Configuration Validation
The Terminal Emulator pane of the Options dialog box now includes a Validate button. When we click
this button, QuickTest checks the current configurations of the selected emulator. If a problem is
detected, a brief description is displayed in the pane. We can also click the Troubleshoot button to view
a Help page that provides additional information about the detected problem.
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 2:50 AM
Set rs=CreateObject("ADODB.RecordSet")
cn.Open "Provider=SQLOLEDB;server=class301;database=employee;trusted_connection=yes"
rs.Open "select * from emp",cn
While rs.EOF<>True
print rs("eno")&" "&rs("ename")&" "&rs("sal")&" "&rs("depcode")
rs.MoveNext
Wend
rs.Close
cn.Close
==================================
'Connection syntax for different databases
'cn.Open "Provider=ORADB;server=servername;userid=xxxx;pwd=xxxx"
'cn.Open "Provider=SQLOLEDB;server=class301;database=employee;uid=xxxxx;pwd=xxxx"
'cn.Open "Provider=Microsoft.jet.oledb.4.0; data source=e:\employee.mdb"
==================================================
Dim cn,rs
Set cn=CreateObject("ADODB.Connection")
Set rs=CreateObject("ADODB.Recordset")
cn.Open "DSN=d1"
rs.Open "select eno,ename from emp",cn
While rs.EOF<>True
print rs("eno")&" "&rs("ename")
rs.MoveNext
Wend
rs.Close
cn.Close
===========================================
Dim cn,rs
Set cn=CreateObject("ADODB.Connection")
Set rs=CreateObject("ADODB.RecordSet")
cn.Open "DSN=QT_Flight32"
For i=1 to 5
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set i
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
cname=window("Flight Reservation").WinEdit("Name:").GetROProperty("text")
tickets=window("Flight Reservation").WinEdit("Tickets:").GetROProperty("text")
rs.Open "select * from orders where order_number="&i,cn
If rs("customer_name")=cname and rs("tickets_ordered")=cint(tickets) Then
Reporter.ReportEvent 0,"Data","The record is matching "
else
Example :
Dim x,y
x=inputbox(Enter a number)
y=inputbox(Enter a number)
print x*y
Example 2
Dim x,y
x=inputbox(Enter a number)
y=inputbox(Enter a number)
msgbox The product of x * y &vbcrlf&x*y,1,Product
In the above example msgbox message,buttons,title
What is a Variable?
A variable is a "container" for information you want to store. A variable's value can change during the
script. You can refer to a variable by name to see its value or to change its value. In VBScript, all variables
are of type variant, that can store different types of data.
Rules for Variable Names:
You can have up to 60 dimensions in an array. Multiple dimensions are declared by separating the
numbers in the parentheses with commas. Here we have a two-dimensional array consisting of 5 rows
and 7 columns:
dim table(4, 6)
Create an arrayArrays are used to store a series of related data items. This example demonstrates how
you can make an array that stores names. ( We are using a "for loop" to demonstrate how you write the
names. )
dim famname(5)
famname(0)="Jan Egil"
famname(1)="Tove"
famname(2)="Hege"
famname(3)="Stale"
famname(4)="Kai Jim"
famname(5)="Borge"
for i=0 to 5
print famname(i)
next
Result
Jan EgilToveHegeStaleKai JimBorge
We have two kinds of procedures: The Sub procedure and the Function procedure.
A Sub procedure:
is a series of statements, enclosed by the Sub and End Sub statements
can perform actions, but does not return a value
can take arguments that are passed to it by a calling procedure
without arguments, must include an empty set of parentheses ()
Sub mysub() some statementsEnd Sub
or Sub mysub(argument1,argument2) some statementsEnd Sub
A Function procedure:
is a series of statements, enclosed by the Function and End Function statements
can perform actions and can return a value
can take arguments that are passed to it by a calling procedure
without arguments, must include an empty set of parentheses ()
returns a value by assigning a value to its name
Function myfunction() some statements myfunction=some valueEnd Function
orFunction myfunction(argument1,argument2) some statements myfunction=some valueEnd Function
Call a Sub or Function Procedure
When you call a Function in your code, you do like this:
name = findname()
Here you call a Function called "findname", the Function returns a value that will be stored in the
variable "name".
If i = 10 then
Print "Just started...!"
elseif i = 11 then
print "Hungry!"
elseif i = 12 then
print "Ah, lunch-time!"
elseif i = 16 then
print "Time to go home!"
else
print "Time zone = Chennai, Kolkatta, Mumbai and Delhi"
end if
end function
call greeting()
Result
Time zone = Chennai, Kolkatta, Mumbai and Delhi
The select case statementThis example demonstrates how to write the select case statement.
d=weekday(date)
select case d
case 1
print "Sleepy Sunday"
case 2
print "Monday again!"
case 3
print "Just Tuesday!"
case 4
print "Wednesday!"
case 5
print "Thursday..."
case 6
print "Finally Friday!"
case else
print "Super Saturday!!!!"
end select
Result
Just Tuesday!
This example demonstrates the "select case" statement.
You will receive a different greeting based on what day it is.
Note that Sunday=1, Monday=2, Tuesday=3, etc.
Looping Statements
Very often when you write code, you want to allow the same block of code to run a number of times.
You can use looping statements in your code to do this.
Exit a Do...Loop
You can exit a Do...Loop statement with the Exit Do keyword.
Do Until i=10 i=i-1 If i<10 Then Exit DoLoop
The code inside this loop will be executed as long as i is different from 10, and as long as i is greater than
10.
Examples
For...next loopThis example demonstrates how to make a simple For....Next loop.
for i = 0 to 2
print "The number is " & i
next
Result
The number is 0
The number is 1
The number is 2
Looping through headersThis example demonstrates how you can loop through the 6 headers in html.
for i=4 to 6
print i
next
For...each loopThis example demonstrates how to make a simple For.....Each loop.
dim names(2)
names(1) = "Tove"
names(0) = "Jani"
names(2) = "Hege"
for each x in names
print x
next
Result
Jani
Tove
Hege
Do...While loopThis example demonstrates how to make a simple Do...While loop.
i=5
do while i < 10
print i
i=i+1
loop
Result
5, 6, 7, 8, 9,
This page contains all the built-in VBScript functions. The page is divided into following sections:
Date/Time functions
Conversion functions
Format functions
Math functions
Array functions
String functions
Other functions
Date/Time Functions
Function
CDate
Converts a valid date and time expression to the variant of subtype Date
The CDate function converts a valid date and time expression to type Date, and returns the result.
Tip: Use the IsDate function to determine if date can be converted to a date or time.
Note: The IsDate function uses local setting to determine if a string can be converted to a date
("January" is not a month in all languages.)
Syntax
CDate(date)
Parameter
Description
date
Required. Any valid date expression (like Date() or Now())
Example 1
d="April 22, 2001"if IsDate(d) then print CDate(d)end ifOutput:2/22/01
Example 2
d=#2/22/01#if IsDate(d) then print CDate(d)end ifOutput:2/22/01
Example 3
d="3:18:40 AM"if IsDate(d) then print CDate(d)end ifOutput:3:18:40 AM
Date
Returns the current system date
The Date function returns the current system date.
Syntax
Date
Example 1
Print "The current system date is: "Print DateOutput:The current system date is: 1/14/2002
DateAdd
Returns a date to which a specified time interval has been added
The DateAdd function returns a date to which a specified time interval has been added.
Syntax
DateAdd(interval,number,date)
Parameter
Description
interval
Required. The interval you want to add
Can take the following values:
yyyy - Year
q - Quarter
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week of year
h - Hour
n - Minute
s - Second
number
Required. The number of interval you want to add. Can either be positive, for dates in the future, or
negative, for dates in the past
date
Required. Variant or literal representing the date to which interval is added
Example 1
'Add one month to January 31, 2000Print DateAdd("m",1,"31-Jan-00")Output:2/29/2000
Print DateAdd("m",1,"31-Jan-00")
Example 2
'Add one month to January 31, 2001Print DateAdd("m",1,"31-Jan-01")Output:2/28/2001
Print DateAdd("m",-1,"31-Jan-01")
Example 3
'Subtract one month from January 31, 2001Print DateAdd("m",-1,"31-Jan-01")Output:12/31/2000
DateDiff
Returns the number of intervals between two dates
The DateDiff function returns the number of intervals between two dates.
Syntax
DateDiff(interval,date1,date2[,firstdayofweek[,firstweekofyear]])
date1,date2
Required. Date expressions. Two dates you want to use in the calculation
firstdayofweek
Optional. Specifies the day of the week.
Can take the following values:
0 = vbUseSystemDayOfWeek - Use National Language Support (NLS) API setting
1 = vbSunday - Sunday (default)
2 = vbMonday - Monday
3 = vbTuesday - Tuesday
4 = vbWednesday - Wednesday
5 = vbThursday - Thursday
6 = vbFriday - Friday
7 = vbSaturday - Saturday
firstweekofyear
Optional. Specifies the first week of the year.
Can take the following values:
0 = vbUseSystem - Use National Language Support (NLS) API setting
1 = vbFirstJan1 - Start with the week in which January 1 occurs (default)
2 = vbFirstFourDays - Start with the week that has at least four days in the new year
3 = vbFirstFullWeek - Start with the first full week of the new year
Example 1
Print Date Print DateDiff("m",Date,"12/31/2002")Print DateDiff("d",Date,"12/31/2002") Print
DateDiff("n",Date,"12/31/2002")Output:1/14/200211351505440
Example 2
Print Date'Note that in the code below'is date1>date2Print
DateDiff("d","12/31/2002",Date)Output:1/14/2002-351
Example 3
'How many weeks (start on Monday),'are left between the current date and 10/10/2002Print Date Print
DateDiff("w",Date,"10/10/2002",vbMonday)Output:1/14/200238
DatePart
Returns the specified part of a given date
The DatePart function returns the specified part of a given date.
Syntax
DatePart(interval,date[,firstdayofweek[,firstweekofyear]])
Example 1
Print Date Print DatePart("d",Date)Output:1/14/200214
Example 2
Print DatePrint DatePart("w",Date)Output:1/14/20022
DateSerial
Returns the date for a specified year, month, and day
The DateSerial function returns a Variant of subtype Date for a specified year, month, and day.
Syntax
DateSerial(year,month,day)
Parameter
Description
year
Required. A number between 100 and 9999, or a numeric expression. Values between 0 and 99 are
interpreted as the years 19001999. For all other year arguments, use a complete four-digit year
month
Required. Any numeric expression
day
Required. Any numeric expression
Example 1
Print DateSerial(1996,2,3)Print DateSerial(1990-20,9-2,1-1)Output:2/3/19966/30/1970
DateValue
Returns a date
The DateValue function returns a type Date.
Note: If the year part of date is omitted this function will use the current year from the computer's
system date.
Note: If the date parameter includes time information it will not be returned. However, if date includes
invalid time information, a run-time error will occur.
Syntax
DateValue(date)
Parameter
Description
date
Required. A date from January 1, 100 through December 31, 9999 or any expression that can represent
a date, a time, or both a date and time
Example 1
Print DateValue("31-Jan-02")Print DateValue("31-Jan")Print DateValue("31-Jan-02 2:39:49
AM")Output:1/31/20021/31/20021/31/2002
Day
Returns a number that represents the day of the month (between 1 and 31, inclusive)
The Day function returns a number between 1 and 31 that represents the day of the month.
Syntax
Day(date)
Parameter
Description
date
Required. Any expression that can represent a date
Example 1
Print DatePrint Day(Date)Output:1/14/200214
FormatDateTime
Returns an expression formatted as a date or time
The FormatDateTime function formats and returns a valid date or time expression.
Syntax
FormatDateTime(date,format)
Parameter
Description
date
Required. Any valid date expression (like Date() or Now())
format
Optional. A Format value that specifies the date/time format to use
Example 1
Print The current date is: "Print FormatDateTime(Date())Output:The current date is: 2/22/2001
Example 2
Print The current date is: "Print FormatDateTime(Date(),1)Output:The current date is: Thursday,
February 22, 2001
Example 3
Print The current date is: "Print FormatDateTime(Date(),2)Output:The current date is: 2/22/2001
Format Values
Constant
Value
Description
vbGeneralDate
0
Display a date in format mm/dd/yy. If the date parameter is Now(), it will also return the time, after the
date
vbLongDate
1
Display a date using the long date format: weekday, month day, year
vbShortDate
2
Display a date using the short date format: like the default (mm/dd/yy)
vbLongTime
3
Display a time using the time format: hh:mm:ss PM/AM
vbShortTime
4
Display a time using the 24-hour format: hh:mm
Hour
Returns a number that represents the hour of the day (between 0 and 23, inclusive)
The Hour function returns a number between 0 and 23 that represents the hour of the day.
Syntax
Hour(time)
Parameter
Description
time
Required. Any expression that can represent a time
Example 1
Print Now Print Hour(Now)Output:1/15/2002 10:07:47 AM10
Example 2
Print Hour(Time)Output:10
IsDate
Returns a Boolean value that indicates if the evaluated expression can be converted to a date
The IsDate function returns a Boolean value that indicates if the evaluated expression can be converted
to a date. It returns True if the expression is a date or can be converted to a date; otherwise, it returns
False.
Note: The IsDate function uses local setting to determine if a string can be converted to a date
("January" is not a month in all languages.)
Syntax
IsDate(expression)
Parameter
Description
expression
Required. The expression to be evaluated
Example 1
Print IsDate("April 22, 1947")Print IsDate(#11/11/01#)Print IsDate("#11/11/01#")Print IsDate("Hello
World!")Output:TrueTrueFalseFalse
Minute
Returns a number that represents the minute of the hour (between 0 and 59, inclusive)
The Minute function returns a number between 0 and 59 that represents the minute of the hour.
Syntax
Minute(time)
Parameter
Description
time
Required. Any expression that can represent a time
Example 1
Print Now Print Minute(Now)Output:1/15/2002 10:34:39 AM34
Example 2
Print Minute(Time)Output:34
Month
Returns a number that represents the month of the year (between 1 and 12, inclusive)
The Month function returns a number between 1 and 12 that represents the month of the year.
Syntax
Month(date)
Parameter
Description
date
Required. Any expression that can represent a date
Example 1
Print DatePrint Month(Date)Output:1/15/20021
MonthName
Returns the name of a specified month
The MonthName function returns the name of the specified month.
Syntax
MonthName(month[,abbreviate])
Parameter
Description
month
Required. Specifies the number of the month (January is 1, February is 2, etc.)
abbreviate
Optional. A Boolean value that indicates if the month name is to be abbreviated. Default is False
Example 1
Print MonthName(8)Output:August
Example 2
Print MonthName(8,true)Output:Aug
Now
Returns the current system date and time
The Now function returns the current date and time according to the setting of your computer's system
date and time.
Syntax
Now
Example 1
Print NowOutput:1/15/2002 10:52:15 AM
Second
Returns a number that represents the second of the minute (between 0 and 59, inclusive)
The Second function returns a number between 0 and 59 that represents the second of the minute.
Syntax
Second(time)
Parameter
Description
time
Required. Any expression that can represent a time
Example 1
Print Now Print Second(Now)Output:1/15/2002 10:55:51 AM51
Example 2
Print Second(Time)Output:51
Time
Returns the current system time
The Time function returns the current system time.
Syntax
Time
Example 1
Print TimeOutput:11:07:27 AM
Timer
Returns the number of seconds since 12:00 AM
The Timer function returns the number of seconds since 12:00 AM.
Syntax
Timer
Example 1
Print TimePrint TimerOutput:11:11:13 AM40273.2
TimeSerial
Returns the time for a specific hour, minute, and second
The TimeSerial function returns the time for a specific hour, minute, and second.
Syntax
TimeSerial(hour,minute,second)
Parameter
Description
hour
Required. A number between 0 and 23, or a numeric expression
minute
7 = vbSaturday - Saturday
Example 1
Print DatePrint Weekday(Date)Output:1/15/20023
WeekdayName
Returns the weekday name of a specified day of the week
The WeekdayName function returns the weekday name of a specified day of the week.
Syntax
WeekdayName(weekday[,abbreviate[,firstdayofweek]])
Parameter
Description
weekday
Required. The number of the weekday
abbreviate
Optional. A Boolean value that indicates if the weekday name is to be abbreviated
Example 1
Print WeekdayName(3)Output:Tuesday
Example 2
Print DatePrint Weekday(Date)Print WeekdayName(Weekday(Date)Output:1/15/20023Tuesday
Example 3
Print Date Print Weekday(Date)Print WeekdayName(Weekday(Date),true)Output:1/15/20023Tue
Year
Returns a number that represents the year
The Year function returns a number that represents the year.
Syntax
Year(date)
Parameter
Description
date
Required. Any expression that can represent a date
Example 1
Print Date Print Year(Date)Output:1/15/20022002
Conversion Functions
Asc(string)
Parameter
Description
string
Required. A string expression. Cannot be an empty string!
Example 1
Print Asc("A")Print Asc("F")Output:6570
Example 2
Print Asc("a")Print Asc("f")Output:97102
Example 3
Print Asc("W")Print Asc("W3Schools.com")Output:8787
Example 4
Print Asc("2")Print Asc("#")Output:5035
CBool Converts an expression to a variant of subtype Boolean
The CBool function converts an expression to type Boolean.
Syntax
CBool(expression)
Parameter
Description
expression
Required. Any valid expression. A nonzero value returns True, zero returns False. A run-time error occurs
if the expression can not be interpreted as a numeric value
Example 1
dim a,ba=5b=10print CBool(a)print CBool(b)Output:TrueTrue
CByte Converts an expression to a variant of subtype Byte
The CByte function converts an expression to type Byte.
Syntax
CByte(expression)
Parameter
Description
expression
Required. Any valid expression
Example 1
dim aa=134.345print CByte(a)Output:134
Example 2
dim aa=14.345455print CByte(a)Output:14
Syntax
CLng(expression)
Parameter
Description
expression
Required. Any valid expression
Example 1
dim a,ba=23524.45b=23525.55print CLng(a)print CLng(b)Output:2352423526
CSng Converts an expression to a variant of subtype Single
The CSng function converts an expression to type Single.
Syntax
CSng(expression)
Parameter
Description
expression
Required. Any valid expression
Example 1
dim a,ba=23524.4522b=23525.5533print CSng(a)print CSng(b)Output:23524.4523525.55
CStr Converts an expression to a variant of subtype String
The CStr function converts an expression to type String.
Syntax
CStr(expression)
Parameter
Description
expression
Required. Any valid expression
If expression is:
Boolean - then the CStr function will return a string containing true or false.
Date - then the CStr function will return a string that contains a date in the short-date format.
Null - then a run-time error will occur.
Empty - then the CStr function will return an empty string ("").
Error - then the CStr function will return a string that contains the word "Error" followed by an error
number.
Other numeric - then the CStr function will return a string that contains the number.
Example 1
dim aa=falseprint CStr(a)Output:false
Example 2
Function
FormatCurrency Returns an expression formatted as a currency value
The FormatCurrency function returns an expression formatted as a currency value using the currency
symbol defined in the computer's control panel.
Syntax
FormatCurrency(Expression[,NumDigAfterDec[,IncLeadingDig[,UseParForNegNum[,GroupDig]]]])
Parameter
Description
Expression
Required. The expression to be formatted
NumDigAfterDec
Optional. Indicates how many places to the right of the decimal are displayed. Default is -1 (the
computer's regional settings are used)
IncLeadingDig
Optional. Indicates whether or not a leading zero is displayed for fractional values:
-2 = TristateUseDefault - Use the computer's regional settings
-1 = TristateTrue - True
0 = TristateFalse - False
UseParForNegNum
Optional. Indicates whether or not to place negative values within parentheses:
-2 = TristateUseDefault - Use the computer's regional settings
-1 = TristateTrue - True
0 = TristateFalse - False
GroupDig
Optional. Indicates whether or not numbers are grouped using the group delimiter specified in the
computer's regional settings:
-2 = TristateUseDefault - Use the computer's regional settings
-1 = TristateTrue - True
0 = TristateFalse - False
Example 1
print FormatCurrency(20000)Output:$20,000.00
Example 2
print FormatCurrency(20000.578,2)Output:$20,000.58
Example 3
print FormatCurrency(20000.578,2,,,0)Output:$20000.58
FormatDateTime Returns an expression formatted as a date or time
The FormatDateTime function formats and returns a valid date or time expression.
Syntax
FormatDateTime(date,format)
Parameter
Description
date
Required. Any valid date expression (like Date() or Now())
format
Optional. A Format value that specifies the date/time format to use
Example 1
print "The current date is: "print FormatDateTime(Date())Output:The current date is: 2/22/2001
Example 2
Print "The current date is: "print FormatDateTime(Date(),1)Output:The current date is: Thursday,
February 22, 2001
Example 3
print "The current date is: "print FormatDateTime(Date(),2)Output:The current date is: 2/22/2001
Format Values
Constant
Value
Description
vbGeneralDate
0
Display a date in format mm/dd/yy. If the date parameter is Now(), it will also return the time, after the
date
vbLongDate
1
Display a date using the long date format: weekday, month day, year
vbShortDate
2
Display a date using the short date format: like the default (mm/dd/yy)
vbLongTime
3
Display a time using the time format: hh:mm:ss PM/AM
vbShortTime
4
Display a time using the 24-hour format: hh:mm
FormatNumber Returns an expression formatted as a number
The FormatNumber function returns an expression formatted as a number.
Syntax
FormatNumber(Expression[,NumDigAfterDec[,IncLeadingDig[,UseParForNegNum[,GroupDig]]]])
Parameter
Description
expression
Required. The expression to be formatted
NumDigAfterDec
Optional. Indicates how many places to the right of the decimal are displayed. Default is -1 (the
computer's regional settings are used)
IncLeadingDig
Optional. Indicates whether or not a leading zero is displayed for fractional values:
-2 = TristateUseDefault - Use the computer's regional settings
-1 = TristateTrue - True
0 = TristateFalse - False
UseParForNegNum
Optional. Indicates whether or not to place negative values within parentheses:
-2 = TristateUseDefault - Use the computer's regional settings
-1 = TristateTrue - True
0 = TristateFalse - False
GroupDig
Optional. Indicates whether or not numbers are grouped using the group delimiter specified in the
computer's regional settings:
-2 = TristateUseDefault - Use the computer's regional settings
-1 = TristateTrue - True
0 = TristateFalse - False
Example 1
print (FormatNumber(20000))Output:20,000.00
Example 2
print FormatNumber(20000.578,2)Output:20,000.58
Example 3
print FormatNumber(20000.578,2,,,0)Output:20000.58
FormatPercent Returns an expression formatted as a percentage
The FormatPercent function returns an expression formatted as a percentage (multiplied by 100) with a
trailing % character.
Syntax
FormatPercent(Expression[,NumDigAfterDec[,IncLeadingDig[,UseParForNegNum[,GroupDig]]]])
Parameter
Description
expression
Required. The expression to be formatted
NumDigAfterDec
Optional. Indicates how many places to the right of the decimal are displayed. Default is -1 (the
Example 2
print Exp(-6.7)Output:1.23091190267348E-03
Hex Returns the hexadecimal value of a specified number
The Hex function returns a string that represents the hexadecimal value of a specified number.
Note: If number is not a whole number, it is rounded to the nearest whole number before being
evaluated.
Syntax
Hex(number)
Parameter
Description
number
Required. Any valid expression
If number is:
Null - then the Hex function returns Null.
Empty - then the Hex function returns zero (0).
Any other number - then the Hex function returns up to eight hexadecimal characters.
Example 1
print Hex(3)print Hex(5) print Hex(9)print Hex(10)print Hex(11)print Hex(12)print Hex(400)print
Hex(459)print Hex(460)Output:359ABC1901CB1CC
Int Returns the integer part of a specified number
The Int function returns the integer part of a specified number.
Note: If the number parameter contains Null, Null will be returned.
Tip: Also look at the Fix function.
Syntax
Int(number)
Parameter
Description
Number
Required. A valid numeric expression
Example 1
print Int(6.83227)Output:6
Example 2
print Int(6.23443)Output:6
Example 3
print Int(-6.13443)Output:-7
Example 4
print Int(-6.93443)Output:-7
Parameter
Description
number
Required. Any valid expression
If number is:
Null - then the Oct function returns Null.
Empty - then the Oct function returns zero (0).
Any other number - then the Oct function returns up to 11 octal characters.
Example 1
print Oct(3)print Oct(5)print Oct(9) print Oct(10) print Oct(11)print Oct(12) print Oct(400)print
Oct(459)print Oct(460)Output:3511121314620713714
Rnd Returns a random number less than 1 but greater or equal to 0
The Rnd function returns a random number. The number is always less than 1 but greater or equal to 0.
Syntax
Rnd[(number)]
Parameter
Description
number
Optional. A valid numeric expression
If number is:
<0 - Rnd returns the same number every time
>0 - Rnd returns the next random number in the sequence
=0 - Rnd returns the most recently generated number
Not supplied - Rnd returns the next random number in the sequence
Example 1
print RndOutput:0.7055475
Example 2
'If you refresh the page,'using the code in example 1,'the SAME random number will show over and
over.'Use the Randomize statement generate a new random number'each time the page is
reloaded!Randomizeprint RndOutput:0.4758112
Example 3
'Here is how to produce random integers in a'given range:dim max,minmax=100min=1print Int((maxmin+1)*Rnd+min)Output:71
Sgn Returns an integer that indicates the sign of a specified number
The Sgn function returns an integer that indicates the sign of a specified number.
Syntax
Sgn(number)
Parameter
Description
number
Required. A valid numeric expression
If number is:
>0 - Sgn returns 1
=0 - Sgn returns 0
<0 - Sgn returns -1
Example 1
print Sgn(15)Output:1
Example 2
print Sgn(-5.67)Output:-1
Example 3
print Sgn(0)Output:0
Sin Returns the sine of a specified number (angle)
The Sin function returns the sine of a specified number (angle).
Syntax
Sin(number)
Parameter
Description
Number
Required. A valid numeric expression that expresses an angle in radians
Example 1
print Sin(47)Output:0.123573122745224
Example 2
print Sin(-47)Output:-0.123573122745224
Sqr Returns the square root of a specified number
The Sqr function returns the square root of a number.
Note: The number parameter cannot be a negative value.
Syntax
Sqr(number)
Parameter
Description
Number
Required. A valid numeric expression >= 0
Example 1
print Sqr(9)Output:3
Example 2
print Sqr(0)Output:0
Example 3
print Sqr(47)Output:6.85565460040104
Tan Returns the tangent of a specified number (angle)
The Tan function returns the tangent of a specified number (angle).
Syntax
Tan(number)
Parameter
Description
Number
Required. A valid numeric expression that expresses an angle in radians
Example 1
print Tan(40)Output:-1.1172149309239
Example 2
print Tan(40)Output:1.1172149309239
Array Functions
Function
Array Returns a variant containing an array
The Array function returns a variant containing an array.
Note: The first element in the array is zero.
Syntax
Array(arglist)
Parameter
Description
Arglist
Required. A list (separated by commas) of values that is the elements in the array
Example 1
dim aa=Array(5,10,15,20)print a(3)Output:20
Example 2
dim aa=Array(5,10,15,20)print a(0)Output:5
Filter Returns a zero-based array that contains a subset of a string array based on a filter criteria
The Filter function returns a zero-based array that contains a subset of a string array based on a filter
criteria.
Note: If no matches of the value parameter are found, the Filter function will return an empty array.
Note: If the parameter inputstrings is Null or is NOT a one-dimensional array, an error will occur.
Syntax
Filter(inputstrings,value[,include[,compare]])
Parameter
Description
Inputstrings
Required. A one-dimensional array of strings to be searched
Value
Required. The string to search for
Include
Optional. A Boolean value that indicates whether to return the substrings that include or exclude value.
True returns the subset of the array that contains value as a substring. False returns the subset of the
array that does not contain value as a substring. Default is True.
compare
Optional. Specifies the string comparison to use.
Can have one of the following values:
0 = vbBinaryCompare - Perform a binary comparison
1 = vbTextCompare - Perform a textual comparison
Example 1
dim
a(5),ba(0)="Saturday"a(1)="Sunday"a(2)="Monday"a(3)="Tuesday"a(4)="Wednesday"b=Filter(a,"n")prin
t b(0)print b(1)print (b(2)Output:SundayMondayWednesday
Example 2
dim
a(5),ba(0)="Saturday"a(1)="Sunday"a(2)="Monday"a(3)="Tuesday"a(4)="Wednesday"b=Filter(a,"n",false
)print b(0) print b(1)print b(2)Output:SaturdayTuesday
IsArray Returns a Boolean value that indicates whether a specified variable is an array
The IsArray function returns a Boolean value that indicates whether a specified variable is an array. If
the variable is an array, it returns True, otherwise, it returns False.
Syntax
IsArray(variable)
Parameter
Description
variable
Required. Any variable
Example 1
dim a(5)a(0)="Saturday"a(1)="Sunday"a(2)="Monday"a(3)="Tuesday"a(4)="Wednesday"print
IsArray(a)Output:True
Example 2
dim aa="Saturday"print IsArray(a)Output:False
Join Returns a string that consists of a number of substrings in an array
The Join function returns a string that consists of a number of substrings in an array.
Syntax
Join(list[,delimiter])
Parameter
Description
list
Required. A one-dimensional array that contains the substrings to be joined
delimiter
Optional. The character(s) used to separate the substrings in the returned string. Default is the space
character
Example 1
dim
a(5),ba(0)="Saturday"a(1)="Sunday"a(2)="Monday"a(3)="Tuesday"a(4)="Wednesday"b=Filter(a,"n")prin
t join(b)Output:Sunday Monday Wednesday
Example 2
dim
a(5),ba(0)="Saturday"a(1)="Sunday"a(2)="Monday"a(3)="Tuesday"a(4)="Wednesday"b=Filter(a,"n")prin
t join(b,", ")Output:Sunday, Monday, Wednesday
LBound Returns the smallest subscript for the indicated dimension of an array
The LBound function returns the smallest subscript for the indicated dimension of an array.
Note: The LBound for any dimension is ALWAYS 0.
Tip: Use the LBound function with the UBound function to determine the size of an array.
Syntax
LBound(arrayname[,dimension])
Parameter
Description
arrayname
Required. The name of the array variable
dimension
Optional. Which dimension's lower bound to return. 1 = first dimension, 2 = second dimension, and so
on. Default is 1
Example 1
dim
a(10)a(0)="Saturday"a(1)="Sunday"a(2)="Monday"a(3)="Tuesday"a(4)="Wednesday"a(5)="Thursday"pri
nt UBound(a)print LBound(a)Output:100
Split Returns a zero-based, one-dimensional array that contains a specified number of substrings
The Split function returns a zero-based, one-dimensional array that contains a specified number of
substrings.
Syntax
Split(expression[,delimiter[,count[,compare]]])
Parameter
Description
expression
Required. A string expression that contains substrings and delimiters
delimiter
Optional. A string character used to identify substring limits. Default is the space character
count
Optional. The number of substrings to be returned. -1 indicates that all substrings are returned
compare
Optional. Specifies the string comparison to use.
Can have one of the following values:
0 = vbBinaryCompare - Perform a binary comparison
1 = vbTextCompare - Perform a textual comparison
Example 1
dim txt,atxt="Hello World!"a=Split(txt)print a(0)print a(1)Output:HelloWorld!
UBound Returns the largest subscript for the indicated dimension of an array
The UBound function returns the largest subscript for the indicated dimension of an array.
Tip: Use the UBound function with the LBound function to determine the size of an array.
Syntax
UBound(arrayname[,dimension])
Parameter
Description
arrayname
Required. The name of the array variable
dimension
Optional. Which dimension's upper bound to return. 1 = first dimension, 2 = second dimension, and so
on. Default is 1
Example 1
dim
a(10)a(0)="Saturday"a(1)="Sunday"a(2)="Monday"a(3)="Tuesday"a(4)="Wednesday"a(5)="Thursday"pri
nt UBound(a)print LBound(a)Output:100
String Functions
Function
InStr Returns the position of the first occurrence of one string within another. The search begins at the
first character of the string
InStrRev Returns the position of the first occurrence of one string within another. The search begins at
the last character of the string
LCase Converts a specified string to lowercase
Left Returns a specified number of characters from the left side of a string
Len Returns the number of characters in a string
LTrim Removes spaces on the left side of a string
RTrim Removes spaces on the right side of a string
Trim Removes spaces on both the left and the right side of a string
Mid Returns a specified number of characters from a string
Replace Replaces a specified part of a string with another string a specified number of times
Right Returns a specified number of characters from the right side of a string
Space Returns a string that consists of a specified number of spaces
StrComp Compares two strings and returns a value that represents the result of the comparison
String Returns a string that contains a repeating character of a specified length
StrReverse Reverses a string
UCase Converts a specified string to uppercase
Other Functions
Function
CreateObject Creates an object of a specified type
Eval Evaluates an expression and returns the result
GetLocale Returns the current locale ID
GetObject Returns a reference to an automation object from a file
GetRef Allows you to connect a VBScript procedure to a DHTML event on your pages
InputBox Displays a dialog box, where the user can write some input and/or click on a button, and
returns the contents
IsEmpty Returns a Boolean value that indicates whether a specified variable has been initialized or not
IsNull Returns a Boolean value that indicates whether a specified expression contains no valid data (Null)
IsNumeric Returns a Boolean value that indicates whether a specified expression can be evaluated as a
number
IsObject Returns a Boolean value that indicates whether the specified expression is an automation
object
LoadPicture Returns a picture object. Available only on 32-bit platforms
MsgBox Displays a message box, waits for the user to click a button, and returns a value that indicates
which button the user clicked
RGB Returns a number that represents an RGB color value
Round Rounds a number
ScriptEngine Returns the scripting language in use
ScriptEngineBuildVersion Returns the build version number of the scripting engine in use
ScriptEngineMajorVersion Returns the major version number of the scripting engine in use
ScriptEngineMinorVersion Returns the minor version number of the scripting engine in use
search of all combinations of all parameters, by "parallelizing" the tests of parameter pairs. The number
of tests is typically O (nm), where n and m are the number of possibilities for each of the two
parameters with the most choices.
D. Fuzz testing
Fuzz testing; fuzzing; Robustness Testing or Negative Testing is a software testing technique that
provides random data ("fuzz") to the inputs of a program. If the program fails (for example, by crashing,
or by failing built-in code assertions), the defects can be noted.
E. Model-based testing
Model-based testing is software testing in which test cases is derived in whole or in part from a model
that describes some (usually functional) aspects of the system under test (SUT).
G. Exploratory testing
Exploratory testing is a method of manual testing that is concisely described as simultaneous learning,
test design and test execution.
Specification-based testing.
H. Specification Based Testing refers to the process of testing a program based on what its specification
says its behavior should be. In particular, we can develop test cases based on the specification of the
program's behavior, without seeing an implementation of the program. Furthermore, we can develop
test cases before the program even exists!
White box testing
White box testing, by contrast to black box testing, is when the tester has access to the internal data
structures and algorithms (and the code that implement these)
code paths, in particular error handling code paths that might otherwise rarely be followed. It is often
used with stress testing and is widely considered to be an important part of developing robust software
Static testing White box testing includes all static testing.
D. Static testing
This is a form of software testing where the software isn't actually used. This is in contrast to dynamic
testing. It is generally not detailed testing, but checks mainly for the sanity of the code, algorithm, or
document. It is primarily syntax checking of the code or and manually reading of the code or document
to find errors. This type of testing can be used by the developer who wrote the code, in isolation. Code
reviews, inspections and walkthroughs are also used.
Grey Box Testing
In recent years the term grey box testing has come into common usage. This involves having access to
internal data structures and algorithms for purposes of designing the test cases, but testing at the user,
or black-box level.
Manipulating input data and formatting output do not qualify as grey-box because the input and output
are clearly outside of the black-box we are calling the software under test. This is particularly important
when conducting integration testing between two modules of code written by two different developers,
where only the interfaces are exposed for test. Grey box testing may also include reverse engineering to
determine, for instance, boundary values or error messages.
Posted by Venkat.G (HOT opening for Freshers Refer www.venkat-jobs.blogspot.com) at 11:30 PM