Thursday, July 22, 2010

What is entry and exit criteria of a test plan?

Entry criteria denotes the conditions or process that must be present before a process can begin.

* All developed code must be unit tested. Unit and Integration Testing must be completed and signed off by development team.
* System Test plans must be signed off by Business Analyst and Test Controller.
* All human resources must be assigned and in place.
* All test hardware and environments must be in place, and free for System test use.
* The Acceptance Tests must be completed, with a pass rate of not less than 80%.
* Build should be ready, testcases should be ready.

Exit criteria as the name implies denotes the conditions or process that must be present before a cycle completes.

*Bug Reports,Test results or Test Summary Report, Test Logs are some of the Exit criteria out of the testing process.
*All High Priority errors from System Test must be fixed and tested.
*If any medium or low-priority errors are outstanding - the implementation risk must be signed off as acceptable by Business Analyst and Business Expert.
*Project Integration Test must be signed off by Test Controller and Business Analyst.
*Business Acceptance Test must be signed off by Business Expert.

what is the difference between action and function?

1.Actions are QTP specific.whereas functions are vb specific.
2.Actions - can only accept primative data types as Parameters (strings, integers, etc)
Functions - can accept arrays, dictionary objects and test objects (i.e. Pages, Frames, WebRadioGroups, etc.)
3.Actions - Return values are difficult to understand and read in the syntax.
Functions - Return values work like they do in other languages.
4.Actions - actions are associated with object Repositry (Per action or shared dependnds).
Functions : functions don't have object repositry associated with them.

Wednesday, July 21, 2010

Find a Cell with Specified Text and Click It

Description
Returns the number of the first row found that contains a cell with the specified text.


Syntax
object.GetRowWithCellText (Text, [Column], [StartFromRow])

Argument Description
object A test object of type WebTable.
Text Required. A String value. The text string for which to search.
Column Optional. A Variant value. The column number where the cell is located. The value can either be the column name or index. Index values begin with 1.
StartFromRow Optional. A Long value. The number of the row in which to start the search. The first row in the table is numbered 1.

Return Value
A Long value.

Sub GetRowWithCellText_Example()

'The following example uses the GetRowWithCellText method to

'find the row in the "OutboundFlights" table that contains the

'text "Price" and then find the cell in that row that contains

'a link and click it.



row = Browser("Mercury Tours").Page("Search Results").WebTable("OutboundFlights").GetRowWithCellText("Price", 2, 2)

Set Link = Browser("Mercury Tours").Page("Search Results").WebTable("OutboundFlights").ChildItem(row, 2, "Link", 0)

Link.Click



End Sub

Tuesday, July 20, 2010

Difference between atendoffile and atendofstream

The difference between AtEndOfline and AtEndOfstream is :
AtEndOfline reads till it encounters a new line.
AtEndOfstream reads till end of the file.


Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("C:\TEMP\testfile.txt", True)
MyFile.WriteLine("This is a test1.")
MyFile.WriteLine("This is a test2."+vbnewline)
MyFile.WriteLine("This is a test3.")
MyFile.Close

AtEndOfline
Const ForReading = 1

Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile = fso.OpenTextFile("C:\TEMP\testfile.txt", ForReading, False)
Do While theFile.AtEndOfline <> True
MSGBOX theFile.Readline
Loop
theFile.Close

returns the output as
This is a test1.
This is a test2.


AtEndOfStream
Const ForReading = 1

Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile = fso.OpenTextFile("C:\TEMP\testfile.txt", ForReading, False)
Do While theFile.AtEndOfstream <> True
MSGBOX theFile.Readline
Loop
theFile.Close

returns the output as
This is a test1.
This is a test2.

This is a test3.

Looping Statements

Looping statements are used to run the same block of code a specified number of times.

In VBScript we have four looping statements:

For...Next statement - runs code a specified number of times
For Each...Next statement - runs code for each item in a collection or each element of an array
Do...Loop statement - loops while or until a condition is true
While...Wend statement - Do not use it - use the Do...Loop statement instead

Important Datetime functions

msgbox day(now())
msgbox weekdayname(weekday(now()))

or

msgbox weekdayname (weekday(day(now())))

msgbox monthname(month(now()))
msgbox year(now())

msgbox hour(now)
msgbox minute(now)
msgbox Second(now)

reading environment variable values from the excel vba

Environ Function

Returns the String associated with an operating system environment variable. Not available on the Macintosh

Syntax

Environ({envstring | number})
The Environ function syntax has these named arguments:

Part Description
envstring Optional. String expression containing the name of an environment variable.
number Optional. Numeric expression corresponding to the numeric order of the environment string in the environment-string table. The number argument can be any numeric expression, but is rounded to a whole number before it is evaluated.

Remarks

If envstring can't be found in the environment-string table, a zero-length string ("") is returned. Otherwise, Environ returns the text assigned to the specified envstring; that is, the text following the equal sign (=) in the environment-string table for that environment variable.

If you specify number, the string occupying that numeric position in the environment-string table is returned. In this case, Environ returns all of the text, including envstring. If there is no environment string in the specified position, Environ returns a zero-length string.



Sub List_Environment_Variables()
Dim EnvString As String
Indx = 1
Do
EnvString = Environ(Indx)
Cells(Indx, 1) = EnvString
Indx = Indx + 1
Loop Until EnvString = ""
End Sub

ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\nbdyvek\Application Data
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=B0024811EE6F0
ComSpec=C:\WINNT\system32\cmd.exe
DEFLOGDIR=C:\Documents and Settings\All Users\Application Data\McAfee\DesktopProtection
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\nbdyvek
LOGONSERVER=\\ASIGGNDCS00
LSERVRC=C:\Program Files\Common Files\Mercury Interactive\License Manager\lservrc
LSHOST=172.23.3.194
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\Program Files\Microsoft Office\Office12\;c:\Program Files\oracle\product\10.2.0\client_1\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;"C:\Program Files\PKWARE\pkzipc"
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 10, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=170a
ProgramFiles=C:\Program Files
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINNT
TEMP=C:\DOCUME~1\nbdyvek\LOCALS~1\Temp
TMP=C:\DOCUME~1\nbdyvek\LOCALS~1\Temp
USERDNSDOMAIN=ASIA.BANKOFAMERICA.COM
USERDOMAIN=ASIA
USERNAME=nbdyvek
USERPROFILE=C:\Documents and Settings\nbdyvek
VSEDEFLOGDIR=C:\Documents and Settings\All Users\Application Data\McAfee\DesktopProtection
WecVersionForRosebud.E88=3
windir=C:\WINNT

Connecting to MS Access DataBase using QTP

Dim rs,con
set con = createobject("adodb.connection")
set rs = createobject("adodb.recordset")
con.provider = "microsoft.jet.oledb.4.0"
con.open "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight32.mdb"
rs.open "select * from Orders where Flight_Number=4219 ",con

'to know the number of orders in class1
'rs.open "select count(*) from Orders group by class",con

'to insert into database
rs.open "insert into emp(empno,empname,empsal) values (4,'lakshmi',400),con

'display each field in the record set
Do while not rs.eof
For Each Field In rs.Fields
MsgBox Field.name
MsgBox Field.value
Next
rs.MoveNext

Loop

' Close the connection.
con.Close

Get the employees count for each location

select count(*),empno from employee group by location;

How to select radio buttons

For a Windows radio button which is not in a group the following is the syntax:
"Set" method : sets the radio button as the selected radio button.

Window("Flight Reservation").WinRadioButton("Business").Set


For a Windows radio button which is in a group the following is the syntax:
Select Selects the specified radio button from the radio group, replacing the previous selection.

e.g.Browser("Google").Page("Google").WebRadioGroup("meta").Select "cr=countryIN"

Wednesday, July 14, 2010

Difference between Updated Run Mode & Maintenance Run Mode?



Update Run mode updates all properties of objects and checkpoints in case of failures. So if a object gets recognized using SMart identification then correct properties are updated in the OR. In case expected and actual values of checkpoints are different then they are updated as per the actuals.It can be selected from Automation -> Update Run mode

Maintenance run mode is used when you want to update objects which are failing during execution. So if the object cannot be recognized at all with current settings instead of giving an error QTP will give a dialog to point the object to a new object if required.

Sunday, July 4, 2010

What is the Automation Framework ?

A framework is an integrated system or an execution environment that sets the rules of Automation of a specific product.

The framework provides the basis of test automation and simplifies the automation effort.

This system integrates the function libraries, test data sources, object details and various reusable modules. These components act as small building blocks which need to be assembled to represent a business process.
There are various types of frameworks. They are categorized on the basis of the automation component they leverage. These are:

Data-driven testing :
Testing of application with multiple sets of data.The disadvatage with this framework is its Application dependent scripts.



Keyword-driven testing :
Keyword-driven testing: In Keyword Driven Framework every keyword represents some code which will perform certain action on the application.We create the excel file in which we provide the steps in simple english words (Keywords) by the user.
Advantage:The advantages for automated tests are the reusability and therefore ease of maintenance of tests that have been created at a high level of abstraction.
Disadvantage: Even for small actions in test Data file we need to write multiple lines to achieve the functionality.

Action Driven framework:
It takes the advantages for the Data Driven and Keyword Driven framework and automates thte application.Every Action here means a specific script which will perform only certain action provided the data in test data file.In RealTime people often call this Hybrid testing.

Hybrid testing :
The hybrid Test Automation Framework is what most frameworks evolve into over time and multiple projects. The most successful automation frameworks generally accommodate both Keyword-driven testing as well as Data-driven testing. This allows data driven scripts to take advantage of the powerful libraries and utilities that usually accompany a keyword driven architecture

What is Test Automation ?

Although manual tests may find many defects in a software application, it is a laborious and time consuming process. In addition it may not be effective in finding certain classes of defects. Test automation is a process of writing a computer program to do testing that would otherwise need to be done manually. Once tests have been automated, they can be run quickly. This is often the most cost effective method for software products that have a long maintenance life, because even minor patches over the lifetime of the application can cause features to break which were working at an earlier point in time.

Do you prefer to work alone or as a team ?

I would like to work in an environment where there are both the sides.
Its great working with team and sharing the knowledge, and learning ideas with each other.
It's also great to sit at my own desk and work independently towards team goal.