Tuesday, September 27, 2011

Ten Tips for effective bug tracking

1.Remember that the only person who can close a bug is the person who findout first.Anyone can resolve it,but only the person who saw the bug can really be sure that when they saw is fixed.

2.A good tester will always try to reduce the reproduction steps to the minimal steps to reproduce.this is extremely helpful for the programmer who has to find the bug.

3.There are many ways to resolve a bug. Developer can resolve a bug as fixed,wont fix,postponed,not pro,duplicate or by design

4.You will want to keep careful track of versions. Every build of the sofware that you give to testers should have a build ID Number so that the poor tester doesnt have to retest the bug on a version of the software where it wasnot even supposed to be fixed.

5.Not reproduce means that nobody could ever reproduce the bug. Programmers often use this when the bug report is missing the reproduce steps.

6.If yoy are a programmer and you are having trouble getting testers to use the bug database, just dont accept bug reports by any other method. If your testers are used to sending you email with bug reports, just bounce the emails back to them with a brief message: “ please put this in the bug database. I cant keep track of emails.

7.If you are a tester, and you are having trouble getting programmers to use the bug database, just dont tell them about bugs – put them in the database and let the database email them.

8.If your are a programmer, and only some of your colleagues use the bug database, just start assigning them bugs in the database. Eventually they will get the hint.

9.If you are a manager, and nobody seems to be using the bug database that you installed at great expense, start assigning new features to people using bug. A bug database is alos a great “unimplemented feature” database, too.

10.Avoid the temptation to add new fields to the bug database.Every month or so, somebody will come up with a great idea for a new field to put in the database. You get all kinds of clever ideas, for example, keeping track of file where the bug was found; keeping track of what % of the time the bug is reproducible; keeping track of how many times the bug occured ; keeping track of which exact versions of which DLLs were installed on the machine where the bug happend. Its very important not to give in to these ideas. If you do , your new bug entry screen will end up with a thousand fields that you need to supply, and nobody will want to input bug reports any more. For the bug database to work, everybody needs to use it, and if entering bugs “formally” is too mush work, people will go around the bug database.

Wednesday, September 21, 2011

Synchronize for a particular object

// Function to Synchronize for a particular object//

Public function fnSynchronization(objName)
fnSynchronization = false

Dim intLoopStart
Dim intLoopwait

intLoopStart = 1
intLoopwait = 10

Set objName = objName

// waiting for the object to appear//
Do while intLoopStart <= intLoopwait
// wait for existance of that object//
If opbjName.Exist(1) then

fnSynchronization = true
Exit do
Else
intLoopStart = intLoopStart+1
End if
Loop
End Function

Verify the items exists in Drop down box

Public Function fnVerifyDroDownItems(objDropdown,strItemsToSearch)

Dim intItemsCount,intCounter,strItem,bInItemPresent
Dim arrItemsToSerach

fnVerifyDropDownItems = True

If (objDropdown.Exist = False) then
reporter.report micFail,"The Dropdown box '" & objDropdown.GetROProperty("name") & "' should Exist", "The Dropdown Box does not exist", "FAIL")
fnVerifyDropDownItems=False
Exit Function
End If

// Get count of items in dropdown //
intItemsCount = objDropdown.GetTOProperty("items count")

// Split the list items list based on comma(,)//

arrItemsToSearch = Split(strItemsToSearch, ",")
For intItems=0 to UBound(arrItemsToSearch)
blnItemPresent = False

// Loop through all items //

For intCounter=1 to intItemsCount
strItem = ""

// Get an item //

strItem = objDropdown.GetItem(intCounter)

// If the search item is present //

If (StrComp(Trim(strItem), Trim(arrItemsToSearch(intItems)), 1) = 0) Then
blnItemPresent = True
reporter.report micPass "The Item '" & arrItemsToSearch(intItems) & "' should be present in the dropdown box", "The specified Item exists in the dropdown box", "PASS")
Exit For
End If
Next
If (Not blnItemPresent) Then
reporter.report micFail , "The Item '" & arrItemsToSearch(intItems) & "' should be present in the dropdown box", "The specified Item does not exist in the dropdown box", "WARNING")
fnVerifyDropDownItems = False
End If
Next
End Function

fetch cell value from table

Dim X
Browser("S.O.S. Math - Mathematical").Page("S.O.S. Math - Mathematical").Frame("Frame").Check CheckPoint("Frame")
Browser("S.O.S. Math - Mathematical").Page("S.O.S. Math - Mathematical").Frame("Frame").WebElement("Class 1 to Class 12 Lessons,").FireEvent "onmouseover",718,13
Browser("S.O.S. Math - Mathematical").Page("S.O.S. Math - Mathematical").Link("A Trigonometric Table").Click 66,12
Browser("S.O.S. Math - Mathematical").Navigate "http://www.sosmath.com/tables/trigtable/trigtable.html"
Browser("S.O.S. Math - Mathematical").Page("Trig Table").Frame("Frame").Check CheckPoint("Frame_2")
Browser("S.O.S. Math - Mathematical").Page("Trig Table").Frame("Frame").Link("Class 1 to Class 12").FireEvent "onmouseover",42,1
Browser("S.O.S. Math - Mathematical").Page("Trig Table").Frame("Frame").WebElement("Lessons, Animations, Videos").FireEvent "onmouseover",45,8
Browser("S.O.S. Math - Mathematical").Page("Trig Table").WebTable("0").Check CheckPoint("0")

x = Browser("S.O.S. Math - Mathematical").Page("Trig Table").WebTable("0").GetCellData(2,4)
msgbox " value is." & x

Browser("S.O.S. Math – Mathematical").CloseAllTabs

Web link counter script

Dim Des_obj,link_col
Browser("editorial » Blog Archive_2").Page("editorial » Blog Archive").Check CheckPoint("editorial » Blog Archive_2")
Browser("editorial » Blog Archive_2").Page("editorial » Blog Archive").Link("Debt Consolidation").Click 48,5
Browser("editorial » Blog Archive_2").Navigate "http://editorial.co.in/debt-consolidation/debt-consolidation.php"
Browser("editorial » Blog Archive_2").Page("editorial » Blog Archive_2").Check CheckPoint("editorial » Blog Archive_3")
Browser("editorial » Blog Archive_2").Page("editorial » Blog Archive_2").Link("Debt Consolidation Calculator").Click 121,4
Browser("editorial » Blog Archive_2").Navigate "http://www.lendingtree.com/home-equity-loans/calculators/loan-consolidation-calculator"
Browser("editorial » Blog Archive_2").Navigate "http://www.lendingtree.com/home-equity-loans/calculators/loan-consolidation-calculator/"
Browser("editorial » Blog Archive_2").Back
Browser("editorial » Blog Archive_2").Navigate "http://editorial.co.in/debt-consolidation/debt-consolidation.php"
Browser("editorial » Blog Archive_2").Back
Browser("editorial » Blog Archive_2").Navigate "http://editorial.co.in/software/software-testing-life-cycle.php"

Set Des_obj = Description.Create
Des_obj("micclass").value = "Link"
Set link_col = Browser("editorial » Blog Archive_2").Page("editorial » Blog Archive").ChildObjects(Des_obj)
msgbox link_col.count


Browser("editorial » Blog Archive_2").CloseAllTabs

Find Tooltips of the specific website

Dim descImage,listImages,attrAltText,attrSrcText

Browser("Browser_2").Navigate "http://www.medusind.com/"
Browser("US Healthcare Revenue").Page("US Healthcare Revenue").Image("Medusind Solutions - Enabling").Click 150,9
Browser("Browser_2").Navigate "http://www.medusind.com/index.asp"


set descImage = description.create
descImage("html tag").value = "IMG"

SET listImages = Browser("Webpage error").page("US Healthcare Revenue").childobjects(descImage)

For i=0 to listimages.count-1
attrAltText = ListImages(i).GetRoProperty("alt")
attrrcText = listImages(i).GetRopRoperty("src")

If attrAltText <> "" Then
Msgbox "Images src: " & attrSrcText & vbnewline & "Tooltip: " & attrAltText
End If

Next

Browser("Webpage error").CloseAllTabs

message window validation

If not dialog( "Login").Exist(2)Then
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\",""
End If
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "rajan"
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure "4e2e616befbf25362991054e9261351ead9a"
Dialog("Login").WinButton("OK").Click
Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Help").Click
Dialog("Flight Reservations").Static("The password is 'MERCURY'").Check CheckPoint("The password is 'MERCURY'")
message = Dialog("text:= Login").dialog("text:= Flight Reservations").Static("window id:= 65535").GetROProperty("text")
Dialog("Flight Reservations").WinButton("OK").Click

If message = "The password is 'MERCURY'" Then
reporter.ReportEvent 0,"Res","Correct message" & message
else
reporter.ReportEvent 1,"Res","Incorrect message"
End If

Check Checkbox using Descriptive programming

Option explicit
Dim qtp,flight_app,f,t,i,j,x,y
If not Window("text:= Flight Reservation:").Exist (2) = true Then
qtp = Environment("ProductDir")
Flight_app = "\samples\flight\app\flight4a.exe"
SystemUtil.Run qtp & Flight_app
Dialog("text:= Login").Activate
Dialog("text:= Login").WinEdit("attached text:= Agent Name:").Set "asdf"
Dialog("text:= Login").WinEdit("attached text:= Password:").SetSecure "4e2d605c46a3b5d32706b9ea1735d00e79319dd2"
Dialog("text:= Login").WinButton("text:= OK").Click
End If

Window("text:= Flight Reservation").Activate
Window("text:= Flight Reservation").Activex("Acx_name:= MaskEdBox","window id:=0").Type "121212"
f = Window("text:= Flight Reservation").WinComboBox("attached text:= Fly From:").GetItemsCount

For i= 0 to f-1 step 1
Window("text:=Flight Reservation").WinComboBox("attached Text:= Fly From:").Select(i)
x =Window("text:=Flight Reservation").WinComboBox("attached Text:= Fly From:").GetROProperty("text")
t = Window("text:=Flight Reservation").WinComboBox("attached text:= Fly To:","x:= 244","y:=143").GetItemsCount
For J = 0 TO t-1 step 1
Window("text:= Flight Reservation").WinComboBox("attached text:= Fly To:","x:= 244","y:=143").Select(j)
y = Window("text:= Flight Reservation").WinComboBox("attached text:= Fly To:","x:= 244","y:=143").GetROProperty("text")
If x <> y Then
Reporter.ReportEvent 0,"Res","Test passed"
else
Reporter.ReportEvent 1,"Res","Test Failed"
End If

Next

Next

Getting dynamic text from the webpage by using text output value function

Step 1: Open google and type as site: motevich.blogspot.com QTP
Step 2: Click search button
Step 3: get a searched result
Step 4: see below google search bar we can view no of results displayed like 1000 or 2000
Step 5: now we can capture that no of values only
Step 6: now just change as test instead of QTP
Step 7: Click search button
Step 8: get a searched result
Step 9: now we can get someother result like 3000 or 4000
Step 10: Stop recording
Step 11: Go to active screen and select the value what we want to get and right click that
Step 12: just click text output value ,screen will open
Step 13: Make some changes in that window
Step 14: click ok
Step 15: again run the script


Browser("Google").Page("Google").WebEdit("q").Set "site: motevich.blogspot.com QTP"
Browser("Google").Page("Google").WebButton("Google Search").Click
Browser("Google").Page("site: motevich.blogspot.com").Sync
Browser("Google").Page("Google").Output CheckPoint("ResCount_2")
msgbox Datatable.Value("count")
Browser("Google").CloseAllTabs

Verify the Check point and if check point is true or false further process is handled using functional statement

Dim Str
Dialog("Login").WinEdit("Agent Name:").Set "rajan"
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure "4e2558dc476c11a2ea3597e2545811aef6477598"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").WinComboBox("Fly To:").Check CheckPoint("Fly To:_2")
Str = Window("Flight Reservation").WinComboBox("Fly To:").Check (CheckPoint("Fly To:"))

msgbox (Str)
If Str = true Then
process()
Else
exitaction()
End If

Private Function process()
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").Dialog("Flight Reservations").WinButton("OK").Click
exitaction()
End Function

Private Function exitaction()
Window("Flight Reservation").Close
End Function

Open Various Application using vb script

Dim wsh
Public Function Launch_App(arg1)
Set wsh=CreateObject("wscript.shell")
wsh.run arg1
Set wsh=nothing
End Function

Call Launch_App("Notepad.exe")
wait 1
Call Launch_App("cmd.exe")
wait 1
Call Launch_App("www.google.com")
wait 1
Call Launch_App("calc.exe")

Run Multiple QTP Test Script using command prompt and display results in command prompt itself

Dim APP //Declaration
Set APP = CreateObject("QuickTest.Application") //create Application object
App.Launch //Start Quicktestapplication
App.Visible = True //make QTP Application visible
Dim QTP_Tests(3) //Declaration
QTP_Tests(1) = "C:\Users\perinbarajani\Documents\HP\QuickTest Professional\Tests\pagecheckpoint" //Set path
QTP_Tests(2) = "C:\Users\perinbarajani\Documents\HP\QuickTest Professional\Tests\textcheckpoint" //Set path
QTP_Tests(3) = "C:\Users\perinbarajani\Documents\HP\QuickTest Professional\Tests\Tooltip" //Set path
set res_obj = CreateObject("QuickTest.RunResultsOptions") //Create run result object

For i=1 to Ubound(QTP_Tests) //For loop running Multiple application
App.Open QTP_Tests(i),True
Set QTP_Test = App.Test
res_obj.ResultsLocation = Qtp_Tests(i) & "QTPResults"
Qtp_Test.Run res_obj,True
QTP_Test.close
Next

App.Quit //Quit the Application
Set res_obj = nothing //Release Result object
Set QTP_Test = nothing // Release the test object
Set App = nothing // Release the application object

Wednesday, September 7, 2011

Bugs, defects and issues

This article explains the terminologies like bugs, defects and issues

All these three terms means the same. It all represents a problem in software.

Background of Bug

In 1946, a huge electromechanical computer stopped functioning suddenly. Operators traced that a bug was trapped in it's relay unit causing the problem. They fixed the problem by removing the bug. Software "bug tracking" and "bug fixing" was evolved from this!

Below is the picture of the first real bug reported:



For several years, the term "bug" and "defect" were widely used in software develop process to indicate problems in software. However, software engineers started questioning the terms "bugs" and "defects" because in many cases they argue that certain "bug" is not a bug, but it is a "feature" or "it is how customer originally asked for it". To avoid conflicts between testing and development team, several companies are now using a different term - "software issue".

Even though both "issue" and "bug" indicate some kind of problems in software, developers feel the term "issue" is less offensive than "bug" ! This is because, the bug directly indicate a problem in the code he wrote, while "issue" is a term which indicates any kind of general problems in the software including wrong requirement, bad design etc.

Whatever problems the QA or testing team find, they will call it as an "issue". An issue may or may not be a bug. A tester may call a feature as a "issue" because that is not what the customer wants, even though it is a nice feature. Or, the software is not delivered to QA team on the date planned, it can be reported as an "issue".

The tester reports issues and his role ends there. It is the job of the product manager to decide whether to solve the issue and how to solve it. Depending on the nature of the issue, the product manager assigns it to the appropriate team to resolve. Product manager may even decide to "waive the issue" if he feels that it is not a problem. If the issue is a bug, then it will be assigned to the developers and they will fix the code. When the bug is fixed, the testing team will re test the software and verify it. If the issues is fixed, then the status of the issue will be changed to "closed".

An issue can be resolved in different ways, depending on it's nature. If it is a software bug, it goes to the developer to correct the code and program. If it is due to wrong requirement, it goes to the customer or marketing to correct the requirement. If the issue was caused by bad configuration in the testing computer, it will be assigned to the appropriate hardware representative to correct the configuration problem.

Software developers like the term "issue" rather than "bug" because the term "issue" does not really indicate that there is a problem in their code ! The term "issue" is becoming the standard in software testing process to indicate problems in software.