Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

How should i validate my controls in Testcomplete by using the checkpoints. MY issue is i want that the user should insert only String in certain textboxes and if any numeric or special symbols are inserted than it should give error.

Thanks

share|improve this question
    
I've provided an answer below however I would suggest that a quick search in the help files available is usually the best place to start and, as pointed out in my answer, will yield some good information on the features you're asking about. –  TristaanOgre Aug 15 '11 at 12:51
add comment

1 Answer 1

The most basic answer can be found in the help documentation on property checkpoints or object checkpoints. However, from there it depends upon whether or not your control exposes a property that specifies the restrictions you place on the control. If such a property exists, it's easy then to create one of those checkpoints on the property and call the comparison code during your test.

If such a property does not exist, then you'll have to create a test (either keyword or script) that will input data into the control and then check for the error message. The specifics of how to check for the error message will depend a lot on how your application generates them.

An example of a VERY simple test is something like:

function CheckStringInput(aControl, aInputString)
{
    aControl.Keys(aInputString)
    if (MyApp.WaitChild("ErrorForm", 5000).Exists) 
    {
        Log.Warning("The error for a bad string was displayed for string" + aInputString)
    }
}

This is a VERY simple test, mind you, and probably doesn't cover all the possibilities. For that matter, it doesn't check to see if the form should come up or not depending upon the string.

Personally, GUI validation tests such as this I find more trouble than they are worth when it comes to creating automated tests. They are low risk for the most part in that, if the proper validation does not happen on the control, it doesn't necessarily create serious problems down the road. For that matter, usually once a form is created and all such things are corrected, the GUI is rarely, if ever, touched again and regression tests of the GUI end up simply being a "busywork" exercise with little or no ROI. If I have nothing better to do with my automation, I write GUI validation code like this but I find that the processing code such as calculating a sales tax, verifying that SQL triggers are properly fired, etc., are much higher risk and give a greater ROI than GUI validation.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.