cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
New Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

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

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/mana...

 

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
2 REPLIES 2
Community Hero

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

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/mana...

 

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Contributor

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

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.

New Here?
Join us and watch the welcome video:
API Testing Mistake #2
APITestingMistake#2
Top Kudoed Authors