Forum Discussion

alexpat's avatar
alexpat
Occasional Contributor
14 years ago

If statement?

I want test if my registration form is functioning properly.



There is some error checking on the form that checks if the email address is valid or if it's already been used.



If the user enters a wrong or existing value the form highlights the error as soon as the user clicks onto another field in the form and displays an error message.



How would I use Test Complete to check this and stop the script at this point with an error message?



I'm assuming that I'm going to have to use an if then statement to check for the error message but I'm unsure of the syntax needed to achieve this.

1 Reply


  • Hi Alex,





    How would I use Test Complete to check this and stop the script at this point with an error message?


    It depends on the way an error message is displayed in your application. For example, if some application object gains specific error text, you can use the property checkpoint (aqObject.CompareProperty). Then, check the returned value and call Runner.Halt to stop the execution. Below is an example in VBScript:





      If(False = aqObject.CompareProperty(<Object's property>, cmpEqual, "error text")) Then

        Runner.Halt("There's an error")

      End If







    If a window containing the error appears, you can use one of the Wait*** methods to check whether this window has appeared.





    Also, you can use the region checkpoint to check whether the form is highlighted or not.