Micro Focus QTP (UFT) Forums
How to fail a test if the checkpoint passes - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: How to fail a test if the checkpoint passes (/Thread-How-to-fail-a-test-if-the-checkpoint-passes)



How to fail a test if the checkpoint passes - aaa - 01-28-2010

I have the below code in my script. I would like to fail the test if the checkpoint passes. That means , if a particular unwanted text is displayed on the page, then I want to fail it. So I inserted a check point to check if the unwanted text is present. But when it is present the check point is passing and the test is also passing. Could you please suggest how to resolve this issue. How to find out what has been retunred to 'a'.?

Code:
a=Browser("Name").Page("Page").WebEdit("edit box").Check (CheckPoint("error"))

Code:
If a = Pass  Then
    reporter.ReportEvent micfail , "arrival date", "todays date not displayed"
End If



RE: How to fail a test if the checkpoint passes - katlu - 01-28-2010

I would think it has to be If a = "Pass". You can have a msgbox after assigning capturing a to find out what it returns.


RE: How to fail a test if the checkpoint passes - aaa - 01-28-2010

Thank you so much for your response. Can you please explain me more on how to get a msgbox with syntax and other req? I am new to VBscripting. Please help me and Thank you once again.


RE: How to fail a test if the checkpoint passes - katlu - 01-28-2010

msgbox a
Code:
a=Browser("Name").Page("Page").WebEdit("edit box").Check (CheckPoint("error"))
msgbox a



RE: How to fail a test if the checkpoint passes - aaa - 01-29-2010

That worked great. Thank you soooo much for your help!!!