Forum Discussion

cpwu2018's avatar
cpwu2018
New Contributor
6 years ago
Solved

keyword test failes first, but repeat the test a few times, it completes

I have several keyword tests to check a website. Most of the tests are recorded. I run them daily and most of them fail at first. If I run them repeatedly and individually, tests will succeed. What shall I do to make my tests more robust?

 

I run the test on Google Chrome.

 

Thanks,

CP

  • It depends, a lot, on what the actual failure errors are that you're getting as to what EXACTLY you need to do.

     

    But generally speaking, for ANY tool (not just TestComplete) relying solely on record/playback for creating tests is a bad practice because of two things:

     

    1) Most automation tools, on playback, execute the test steps as fast as possible.  If not explicitly told to do so, this means that actions may be attempt against an on screen component before the component is ready to be interacted with.  We've kind of coined the term on these forums as "timing issues" where you get an error on clicking or typing on an object because you get an "object not found" or "object disabled" kind of error.  There are a variety of techniques to "fix" this in your project.  The following landing page in the help contains multiple topics covering these scenarios.

     

    https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/index.html

     

    2) The NameMapping engine is the core of how TestComplete identifies objects.  It uses a combination of object hierarchy and property/value pairs to identify objects.  Sometimes, those property/value pairs are dynamic in nature, including ID's, text, etc., that varies from test run to test run.  This means that these object identifications need to be edited to be more robust.  Read the topics found https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/managing/index.html

     

    I would guess, by your explanation of the problem, that your primary issue is the first one... that there are things that are happening too fast for the application to keep up.  Give that a try, adding wait code in various places to see if this cleans things up.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    It depends, a lot, on what the actual failure errors are that you're getting as to what EXACTLY you need to do.

     

    But generally speaking, for ANY tool (not just TestComplete) relying solely on record/playback for creating tests is a bad practice because of two things:

     

    1) Most automation tools, on playback, execute the test steps as fast as possible.  If not explicitly told to do so, this means that actions may be attempt against an on screen component before the component is ready to be interacted with.  We've kind of coined the term on these forums as "timing issues" where you get an error on clicking or typing on an object because you get an "object not found" or "object disabled" kind of error.  There are a variety of techniques to "fix" this in your project.  The following landing page in the help contains multiple topics covering these scenarios.

     

    https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/index.html

     

    2) The NameMapping engine is the core of how TestComplete identifies objects.  It uses a combination of object hierarchy and property/value pairs to identify objects.  Sometimes, those property/value pairs are dynamic in nature, including ID's, text, etc., that varies from test run to test run.  This means that these object identifications need to be edited to be more robust.  Read the topics found https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/managing/index.html

     

    I would guess, by your explanation of the problem, that your primary issue is the first one... that there are things that are happening too fast for the application to keep up.  Give that a try, adding wait code in various places to see if this cleans things up.

    • cpwu2018's avatar
      cpwu2018
      New Contributor

      Thanks for the advices. I am in the process of reviewing my tests and add proper delays when necessary to see if it makes difference. I will post updates after the exercise.