logo logo

Challenges in Test Automation for Desktop Applications

Challenges in Test Automation for Desktop Applications

We used web desktop apps long before web and mobile apps. However, testing them has become rarer, and if your work involves test automation for desktop applications, there are some challenges you might encounter. Let’s go over them 👀

1️⃣ Picking the right tool for the job

This is a challenge in most test automation projects, but even more so for desktop apps. While for web and mobile apps we might have too many choices, the same can’t be said for desktop.

Communities are not as large either, so finding support for issues you encounter can be harder to find. Choosing a tool may require a lot of research and depends on the needs of the project. Some things to consider are:

  • The budget: Are you looking for a free tool or are you willing to invest money in a commercial tool?
  • Support: Because fewer testers work on desktop test automation, it will be harder to find solutions to your coding problems on Stack Overflow or other similar sites. So good support is something to look into.
  • The team’s test automation skills / the learning curve: Some tools can be easy to use, others less so. Either way, time must be invested in getting the team familiar with a new tool. If most of the testers of the team are newbies when it comes to writing code for tests, consider a tool that doesn’t have a steep learning curve.
  • Features: Of course, you need to make sure that the tool you will start using has all the features you actually need. Don’t get too excited by tools that offer lots of features, unless you will actually use all those features in your project.
  • Reporting: Reporting is really important when it comes to automation testing. How can you demonstrate the value it brings? How can you see progress or trends? A good reporting system can aid with all of this.
  • Integration: Is the tool integrated with other tools your team is already using? It can be really useful to be able to integrate the automation testing solution with other tools, such as bug trackers, project management tools, and CI/CD.

2️⃣ Finding a good locator strategy

As opposed to web test automation, where you can use the browser’s developer tools, or various addons for the browsers, for desktop applications finding locators can be a little trickier. You can still use XPath, like with any other UI testing, but you won’t have the same usual and recommended attributes, like CSS selector, class name, or link text.

Many of the tools offer their own UI inspectors that will help generate locators, and for Windows apps, you can use Microsoft’s accessibility insights, or the legacy application inspect. You can find similar tools for Mac or Linux as well.

If the developers are on board, you could use custom attributes. That will save the testers a lot of time and energy when building the locators for the UI elements. After all, it’s in everyone’s interest to have a reliable testing process, which helps maintain the overall quality of the product.

3️⃣ Complex scenarios

UI automation usually deals with bigger test scenarios, as opposed to unit or integration testing. Especially if we are also doing end-to-end testing (which can often be the case).

When it comes to desktop applications, they are usually in themselves more complex. Therefore the test cases and scenarios for automation will also be more complex 👨‍💻 This means that implementing the tests can pose a somewhat greater challenge for desktop apps.

Choose the tests to automate wisely, and don’t be afraid to rely also on unit and integration testing – if something can be automated on a lower level, don’t duplicate the test scenario by testing them through the UI too.

4️⃣ Setups & teardowns

Two important parts of the automated tests are the setup, or the test preconditions, and the teardown. These too can represent a challenge when it comes to automating tests for a desktop app.

Consider this: for a Selenium test automation project, the setup and teardown mean opening and closing the browser (they can involve other steps too, but these ones are a given). Each time a new test starts, the browser is in a clean state, with no cookies, no cache, no users signed in, etc.

However, restarting a desktop app is not enough to have it in a clean state. There are many “residual” files that a desktop application might create. These can be things like registry entries, or license and registration files. Of course, it’s not impossible to get rid of those, but this requires a bit of extra work and should not be neglected during the teardown of the tests.

5️⃣ Parallel running

This can also be a tricky aspect. Because as opposed to web test automation, where you can use multiple browsers, for desktop applications you need to have multiple instances of the app open at the same time. It’s usually impossible to have multiple instances with different settings, i.e. different license types or different users.

Another complication comes from the fact that some of the automation tools that interact with the apps have to actually use the mouse or keyboard, they don’t just simulate the actions through the browser. This means that you can only interact with one instance at a time, which can considerably increase the test execution time.

The solution? You can run each instance of the app on a separate machine. This means of course investing in a serious infrastructure, with multiple machines (physical or virtual), and installing the app on each one. Which brings us to the last point 👇

6️⃣ Installation

Installing a desktop app is usually the user’s job. As opposed to a web app, where the development or DevOps team will install it on a server, desktop apps come with an installer that needs to run on the user’s machine.

It’s important to test the installation (both from scratch or through updates) to make sure everything works OK. You might want to consider testing the uninstall process as well.

And if you are running the tests in a CI/CD environment, you will need to also automate the installation process. That’s because you will need the tests to run on the correct application build, and you will need that build on all machines where you are running the tests.

Conclusions

Test automation for desktop applications can come with some different challenges, but with a good strategy in place and a good preparation, we can overcome all of them. This article explained some of the most common ones you should expect if you are starting a desktop app testing project ✅

Avatar

About the author

Andreea Draniceanu

Andreea is a QA engineer, experienced in web and desktop applications, and always looking to improve her automation skills and knowledge. Her current focus is automation testing with C#.

Leave a Reply

FacebookLinkedInTwitterEmail