Avoiding the “Unable to Find Object” Error in TestComplete
Automated testing is a great way to save time and increase test efficiency but nothing is perfect, unfortunately. Automated test performance is directly affected by how hardware, objects and the code in which we are testing react to the tests and other processes running in parallel. Test environment set up and test maintenance is crucial in the test automation process, because improper set up and maintenance can cause performance issues causing tests to fail before they even have a chance to detect defects.
Here are some reasons an automated test could be interrupted:
- Hardware error or failure
- Software hang or crash
- Object timeout
One of the most common performance issues seen in TestComplete is the “Unable to find object” error. Nothing is worse than having your automated tests come to a screeching halt because they were interrupted. However, the issue here isn’t the automated tests themselves, but object load times causing timeouts during a test. Sometimes automated tests will quickly select an object that hasn’t had time to load, for instance, selecting an object before the window in which the object to be tested is embedded has finished opening. There should be a set amount of time to allow an object to load, since TestComplete can run tests at a faster pace than some objects can load. By default, TestComplete will wait 10 seconds for an object to load, if it happens to take longer the test will fail and you will get a test error “Process not found.”
There are a few ways in which you can change the timeout. You can change the default Auto-Wait timeout for TestComplete or by adding a timeout to the test script or a keyword test.
To change the Auto-Wait timeout (default) for TestComplete:
1. Double click on the project name in the Project Explorer.
2. Click on Properties.
3. Select Playback.
4. Change the Auto-wait timeout to a preferred amount of time and make sure Stop on error option is checked.
You also can set timeouts for individual operations in TestComplete. This may be the preferred method if it is only an individual object giving you trouble. This is done by using a timeout parameter.
5. Right click on the grid header and select Field Chooser.
6. Drag the Auto-wait timeout command to the grid header.
7. Specify the amount of time (ms) to wait before the next operation.
If you ever have any issues with TestComplete, the SmartBear community forums are a great place to find the answer you may be looking for.
We always love to hear your feedback, so feel free to drop a line below and let us know how we’re doing. Our support team is ready to assist and you can always check out our FAQs if you need to find an answer quickly.