03-06-2011, 08:49 PM
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.
What should i do for this problem?
Thanks a lot.
My test script is such below:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
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.
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