The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:
Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1
nitinchobhe
Member


Reged: 02/14/07
Posts: 32
Loc: Pune, Maharashtra, India
Can - ve testing be done using QTP?
      #378801 - 05/08/07 02:17 AM

Hello Everybody!

I'm working on QTP 9.2
Windows based application

In this application there is a form to enter employee details like Emp ID, Name, Surname, Department, Section, Gender, Location, Date of Birth, Date of Joining etc. There are various validations on these fields e.g. Emp ID is an Edit box and it accepts only Numbers in a defined range. If the user enters alphabets, it displays an error message. Similarly if she enters a number out of the defined range it would display related error message...

My question is how can we check if the application displays the error message related to the invalid data? Say I enter alphabets in Emp ID and the application displays error message. It's ok. I can get the error message text and compare it. But if in second round of regression, it doesn't display the Error message at all and successfully adds the employee in database, how would I come to know that there is a defect introduced in this second round?????

I've tried a lot but couldn't solve this... Any thoughts???

Regards,
Nitin


Post Extras: Print Post   Remind Me!   Notify Moderator  
robbiewinston
Super Member


Reged: 03/06/06
Posts: 1554
Loc: Bristol, UK
Re: Can - ve testing be done using QTP? [Re: nitinchobhe]
      #378805 - 05/08/07 03:05 AM

Why can't you perform the same test second time around?

Post Extras: Print Post   Remind Me!   Notify Moderator  
abrakh
Junior Member


Reged: 10/17/05
Posts: 352
Re: Can - ve testing be done using QTP? [Re: nitinchobhe]
      #378808 - 05/08/07 03:13 AM

Hi nitinchobhe,

1. First of all identify the Regression suite what all the +ve abnd -ve test cases ypu will have.

2. Use Data table and have coulums for input and expected out put eg:
Row 1. +ve test case emp number input will have all numbers expected out put will be no error (pop-up or specified location text)

Row 2. -ve test case input the emp number with alphabets expected out put will be xxxxxx error (pop-up or specified location text)

3. In you script make it robust by putting a If condition without an ELSE to handle the pop-up etc generated by the -ve test case.

hope it helps ...

The script may look some what like ....
window("application").winedit("empno").set "123"
window("application").winbutton("submit").click
If (Check pop-up or text or specified location)= (expected output from datatable) then
Pass
else
Fail
end IF


Post Extras: Print Post   Remind Me!   Notify Moderator  
abrakh
Junior Member


Reged: 10/17/05
Posts: 352
Re: Can - ve testing be done using QTP? [Re: abrakh]
      #378812 - 05/08/07 03:19 AM

But if in second round of regression, it doesn't display the Error message at all and successfully adds the employee in database, how would I come to know that there is a defect introduced in this second round?????

Sorry I got u wrong ...
Here if it does not displays the error message at all and if teh error message is EXPECTED then it is a bug for not showing teh error message .. forget about whether it adds the record successfully to the database or not ...


Post Extras: Print Post   Remind Me!   Notify Moderator  
ififthelement
Member


Reged: 09/26/01
Posts: 169
Loc: Chicago
Re: Can - ve testing be done using QTP? [Re: abrakh]
      #378904 - 05/08/07 06:53 AM

Check if you are comitting the changes made in first round. or chekc the data you are sending, it must be different or the application is treating it differently.

well if you could send the code as attachment or just type the necessary code for us to evaluate?

--------------------
ififthelement
--------------
"life is simple if you can see both sides of a coin" - by me


Post Extras: Print Post   Remind Me!   Notify Moderator  
nitinchobhe
Member


Reged: 02/14/07
Posts: 32
Loc: Pune, Maharashtra, India
Re: Can - ve testing be done using QTP? [Re: ififthelement]
      #379163 - 05/09/07 04:31 AM

Hi Everybody,

Thanks for your help. I got it. I've used

Reporter.Report event

Following is the code:
'---------------------------Script------------------------
Window("Recorder+ -").Dialog("admin").Dialog("MasterEmployeeTable").WinButton("New Card").Click 'Clicks on the New Record button to load the
'New Employee Form


'**********************************************************************************************
With Window("Recorder+ -").Dialog("admin").Dialog("MasterEmployeeTable").Dialog("MasterEmployeeTable")


'*********Following code will enter the data into the Emp ID field on Employee details form and check for the validations*****

Dim ExpectedMsg_Arr(9) ' Declaration of an array to hold the Expected Error messages
Dim testData_Arr(9) ' Declaration of an array to hold the test data
Dim testMsg_Arr(9) ' Declaration of an array to hold the message to be written in the Results of the Test

testData_Arr(1) = "aaa" '1. Enter Characters
testData_Arr(2) = "1234567" '2. Enter Emp ID > Six characters
testData_Arr(3) = "123" '3. Valid Emp ID
testData_Arr(4) = "!@#" '4. Special Characters
testData_Arr(5) = " " '5. White spaces
testData_Arr(6) = "-231" '6. Negative Emp ID

testMsg_Arr(1) = "Accept only Numbers"
testMsg_Arr(2) = "Accept Emp ID in defined range"
testMsg_Arr(3) = "Accept valid Emp ID"
testMsg_Arr(4) = "Work correctly for Special Characters"
testMsg_Arr(5) = "Work correctly for White Spaces"
testMsg_Arr(6) = "Work correctly for Negative Emp ID"

ExpectedMsg_Arr(1) = "Please enter numbers only for Employee Code field"'............................1: Empcode validation
ExpectedMsg_Arr(2) = "Please enter employee ID less than 1000000"'..........................................2: For Emp ID> Six characters
ExpectedMsg_Arr(3) = "Please enter Name" '..........................................................................................3. For valid Emp ID
ExpectedMsg_Arr(4) = "Please enter numbers only for Employee Code field"'............................4. For Special Characters
ExpectedMsg_Arr(5) = "Please enter numbers only for Employee Code field"'............................5. For White spaces
ExpectedMsg_Arr(6) = "Please enter numbers only for Employee Code field"'............................6. For Negative Emp ID

For i=1 to UBound (testData_Arr)-3

.WinEditor("Employee Code").Type testData_Arr(i) 'Enter the Test data in Emp ID field
.WinButton("Return").Click 'Clicks on Save button

If .dialog("Recorder+").Exist then ' Checks if the Error message is displayed
strTxt=.dialog("Recorder+").GetVisibleText 'If the message is displayed, gets the message in strTxt
If InStr(1,strTxt,ExpectedMsg_Arr(i)) >0Then 'Checks if the Expected and Actual messages are same
Reporter.ReportEvent micPass,"EmpId", testMsg_Arr(i) ' If the messages match, writes PASS against the EmpId
Else
Reporter.ReportEvent micFail ,"EmpId", "Does not"+ testMsg_Arr(i) ' If the messages don't match, writes FAIL against the EmpId
End If

Else
Reporter.ReportEvent micFail ,"EmpId", "Does not display error message" 'If no message is displayed after clicking on SAVE button, writes it in results
End if

ClickOnReturn 'Calls to a procedure which clicks on RETURN and EXIT button

' If i= UBound (testData_Arr) Then 'This If..Else condition is used to skip the For Loop for last iteration as for last iteration it is not needed
' Exit For 'to click on NEW RECORD button
' End If

Window("Recorder+ -").Dialog("admin").Dialog("MasterEmployeeTable").WinButton("New Card").Click 'Clicks on NEW RECORD button
Next

End With
'-----------------------------End of script--------------


Regards,
Nitin


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 55 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 958

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5