Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to not fail on handeled run error in web service test
#1
Solved: 11 Years, 4 Months ago
Hi All,
I am beginner in QTP and using version 10 of QTP for functional testing of webservices. but a problem. i could test a correct state of my webservice successfully but for state that my webservice have to return a error that i expected, it fail when i test it. i said to it :
if ( isExpectedErrorOccure ) Reporter.ReportEvent micPass, "Login Test", "test reason: passed."
But when the webservice return a correct handled error it set the test result to failed, but for me it is passed. Sad
What should i do for this problem?
Thanks a lot.
My test script is such below:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Code:
WebService("ServicesService_2").login XMLWarehouse("userBean")
testError = WebService("ServicesService_2").GetLastError
if  ( reason = "Incorrect password" )  then
expectedError = "User name or password is incorrect!"
isExpectedErrorOccure = InStr(testError, expectedError)
if(isExpectedErrorOccure >0) then
Reporter.ReportEvent micPass, "Login Test",  "test reason: " & reason & " passed."
else
Reporter.ReportEvent micFail, "Login Test",  "test reason: " & reason & "  failed."
end if
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Reply
#2
Solved: 11 Years, 4 Months ago
may be it shoud be

Code:
if(isExpectedErrorOccure <0) then
Reporter.ReportEvent micFail, "Login Test", "test reason: " & reason & " failed."
else
Reporter.ReportEvent micPass, "Login Test", "test reason: " & reason & " passed."
Reply
#3
Solved: 11 Years, 4 Months ago
Thank you Jenny,
Really excuse me about my poor English.
exactly my problem is about < WebService("ServicesService_2").login XMLWarehouse("userBean") > ..when it run this line it return a run error but for me it is true and expected error that i handled in my webservice and i want to pass it. what is the solution?
for example in script above when i enter a Incorrect username and password for the login service, the expected error is "User name or password is incorrect!". i want when it return this error message i pass it but it return a run error because of Incorrect password. no deference between unhandled error and handled error ... Sad
I attached a print-screen of my test result that may be useful for problem understanding. Smile


Attached Files Image(s)
   
Reply
#4
Solved: 11 Years, 4 Months ago
You must forgive my neurons, they have been having a hard time, but if i have got what you said, then i believe, this is what you are looking for,

Code:
On Error Resume Next
WebService("ServicesService_2").login XMLWarehouse("userBean")
testError = WebService("ServicesService_2").GetLastError
if  ( reason = "Incorrect password" )  then
     expectedError = "User name or password is incorrect!"
if InStr(testError, expectedError) <> 0 then
      Reporter.ReportEvent micPass, "Login Test",  "test reason: " &        reason & " passed."
else
  Reporter.ReportEvent micFail, "Login Test",  "test reason: " & reason    & "  failed."
End if
msgbox Err.Number &" "& Err.Description
End if
Let me know if this works?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#5
Solved: 11 Years, 4 Months ago
Hey All...
service test 11.00 really solve my problem or maybe their faultSmile
Enjoy iT
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to send/pass UFT Run Error Dialog as output value to main driver script lravi4u 0 595 11-05-2023, 03:55 PM
Last Post: lravi4u
  Send automatic email notification when test run started helmzshelmz 0 1,081 04-03-2020, 07:54 AM
Last Post: helmzshelmz
  How to identify an error page occurring in server in between the qtp run. aswini 1 1,801 05-04-2017, 03:52 PM
Last Post: Ankur
  Test runned from QualityCenter generated an error "Attempted to divide by zero." robertosalemi 1 2,572 10-14-2016, 08:38 PM
Last Post: robertosalemi
  Exe invoked through UFT is unable to access IIS and SQL Server service bkdevise 0 2,158 08-25-2015, 05:49 PM
Last Post: bkdevise

Forum Jump:


Users browsing this thread: 1 Guest(s)