I have been using test Complete to build automated GUI tests. Whenever developers put in a fix, my tests break. They keep changing web elements IDs and / or attributes.

I know this is a broad question, but is it possible to stop test cases from being so fragile?

2 Answers 2


There are two ways to do it and I recommend you use both in a hybrid approach.

  1. Talk to your developers, ask them to stop changing web elements if possible. testComplete is a record and play tool, like its cousin Selenium IDE, the way testComplete maps its elements is very structure-dependent, which means if there is any slight change in web element structure, testComplete will complain about it and your test cases will break. The way to keep it from happening is to keep web element structure as it is.
  2. Use more JavaScript, less record and play. Instead of relying on testComplete to locate a web element, you can use JavaScript to locate a web element via css selector or xpath. You will notice css and xpath are less structure dependent, which means your tests will be more stable.

The hybrid approach is that you should talk to your developers first, telling them that they should be aware any change they make will impact your test cases. Then, refactor your test cases using JavaScript.

It will be a long and even painful road to maintain automated GUI test cases, so you will have to take one step at a time.


I think there are a number of options and which ones are correct will depend on your organization, developers, opinions, experience, etc. Some of the options (more than 1 may apply) are:

  • Use framework generated attributes. For example Ruby on Rails uses the name attribute.

  • Make the tests you are running available to developers to run.

  • Use a CI build server that runs your tests when developers push their changes

  • Become more involved in code review so you can spot such changes

  • Make sure the definition of done includes your tests passing

  • Have QA specific tags through data attributes, possibly removed from production pages

  • Use robust strategies for selecting elements so you are not relying on page layout

  • Avoid external tool or browser inspect element css or xpath - they include layout and are brittle


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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