Select Page

Category Selected: Desktop App Automation Testing

7 results Found


People also read

Desktop Automation Testing

TestComplete Features Every QA Engineer Should Know

Desktop Automation Testing
Accessibility Testing

Talk to our Experts

Amazing clients who
trust us


poloatto
ABB
polaris
ooredo
stryker
mobility
TestComplete Features Every QA Engineer Should Know

TestComplete Features Every QA Engineer Should Know

Modern software teams are expected to deliver high-quality applications faster than ever. However, as desktop applications become more complex, relying only on manual testing can slow down release cycles and increase the risk of defects. This is where understanding the TestComplete features becomes valuable for QA teams looking to automate their testing processes efficiently. TestComplete, developed by SmartBear, is a powerful automation tool designed to test desktop, web, and mobile applications. It is especially known for its strong desktop testing capabilities, supporting technologies like .NET, WPF, Java, and Delphi. With features such as keyword-driven testing, intelligent object recognition, and multi-language scripting, TestComplete helps teams automate repetitive tests, improve test coverage, and deliver more reliable software releases.

In this guide, we’ll walk through the key TestComplete features, explain how they work, and compare them with other automation tools. By the end, you’ll have a clear understanding of how TestComplete helps QA teams automate desktop applications faster and more reliably.

What is TestComplete?

TestComplete is a functional UI test automation tool created by SmartBear. It allows teams to automate end-to-end tests for:

  • Desktop applications
  • Web applications
  • Mobile applications

QA teams typically use TestComplete for tasks like:

  • Regression testing
  • UI validation
  • Functional testing
  • End-to-end workflow testing

One of the most attractive aspects of TestComplete is its flexibility in scripting languages. Teams can write automation scripts using:

  • Python
  • JavaScript
  • VBScript
  • JScript
  • DelphiScript
  • C++Script
  • C# Script

This flexibility makes it easier for teams to integrate TestComplete into existing testing frameworks and workflows.

Key TestComplete Features for Desktop Test Automation

Intelligent Object Recognition

One of the most impressive TestComplete features is its object recognition capability.

Instead of interacting with UI elements based on fragile screen coordinates, TestComplete identifies application components based on their properties and hierarchy.

In simpler terms, the tool understands the structure of the application UI. So even if the layout changes slightly, the automation script can still locate the correct elements.

Why this matters

Without strong object recognition, automation scripts often break when developers update the interface. TestComplete reduces this problem significantly.

Example

Imagine testing a desktop login form.

A coordinate-based test might click on a button like this:

Click (X:220, Y:400)

But if the interface changes, the script fails.

With TestComplete, the script targets the object itself:

Aliases.MyApp.LoginButton.Click()

This approach makes automation far more reliable and easier to maintain.

Keyword-Driven Testing (Scriptless Automation)

Not every tester is comfortable writing code. TestComplete solves this by offering keyword-driven testing.

Instead of writing scripts, testers can create automated tests using visual steps such as:

  • Click Button
  • Enter Text
  • Verify Property
  • Open Application

These steps are arranged in a structured workflow that defines the automation process.

Why QA teams like this feature

Keyword testing allows manual testers to participate in automation, which helps teams scale their automation efforts faster.

Benefits include:

  • Faster test creation
  • Lower learning curve
  • Better collaboration between testers and developers

Multiple Scripting Language Support

Another major advantage of TestComplete is that it supports multiple scripting languages.

Different teams prefer different languages depending on their technology stack.

S. No Language Why Teams Use It
1 Python Popular for automation frameworks
2 JavaScript Familiar for many developers
3 VBScript Common in legacy enterprise environments
4 C# Script Useful for .NET applications

This flexibility allows organizations to choose the language that best fits their workflow.

Record and Playback Testing

For teams just starting with automation, TestComplete’s record-and-playback feature is extremely helpful.

Here’s how it works:

  • Start recording a test session
  • Perform actions in the application
  • Save the recording
  • Replay the test whenever needed

The tool automatically converts recorded actions into automation steps.

When is this useful?

Record-and-playback works well for:

  • Simple regression tests
  • UI workflows
  • Quick automation prototypes

However, most mature QA teams combine recorded tests with custom scripts to make them more stable.

Cross-Platform Testing Support

Although TestComplete is widely known for desktop automation, it also supports testing across multiple platforms.

Teams can automate tests for:

  • Desktop applications
  • Web applications
  • Mobile apps

This allows organizations to maintain one centralized automation platform instead of managing multiple tools.

Supported desktop technologies

  • Windows Forms
  • WPF
  • .NET
  • Java
  • Delphi
  • C++

This makes it especially useful for enterprise desktop applications that have been around for years.

Data-Driven Testing

Another powerful feature is data-driven testing, which allows the same test to run with multiple data inputs.

Instead of creating separate tests for each scenario, testers can connect their automation scripts to external data sources.

Common data sources include:

  • Excel spreadsheets
  • CSV files
  • Databases
  • Built-in data tables

With data-driven testing, one script can validate all these scenarios automatically.

This approach significantly reduces duplicate tests and improves coverage.

Detailed Test Reports and Logs

Understanding why a test failed is just as important as running the test itself.

TestComplete generates detailed execution reports that include:

  • Test steps performed
  • Screenshots of failures
  • Execution time
  • Error messages
  • Debug logs

These reports make it easier for QA teams and developers to identify and fix issues quickly.

CI/CD Integration

Modern software teams rely heavily on continuous integration and continuous delivery pipelines.

TestComplete integrates with popular CI/CD tools such as:

  • Jenkins
  • Azure DevOps
  • Git
  • Bitbucket
  • TeamCity

This allows automation tests to run automatically during:

  • Code commits
  • Build pipelines
  • Release validation

The result is faster feedback and improved release confidence.

TestComplete vs Other Automation Tools

S. No Feature TestComplete Selenium Ranorex Katalon
1 Desktop Testing Strong Limited Strong Limited
2 Scriptless Testing Yes No Yes Yes
3 Record & Playback Yes Limited Yes Yes
4 Built-in Reporting Advanced Requires plugins Good Good
5 Enterprise Support Strong Community Strong Medium

Key takeaway

TestComplete is often the preferred choice for teams that need reliable desktop automation and enterprise-level capabilities.

Example: Automating a Desktop Banking System

Consider a QA team working on a desktop banking application.

Before automation, the team manually tested features like:

  • User login
  • Transaction processing
  • Account updates
  • Report generation

Regression testing took two to three days every release cycle.

After implementing TestComplete:

  • Login tests were automated using keyword testing.
  • Transaction workflows were scripted using Python.
  • Multiple users were tested through data-driven testing.
  • Tests were integrated with Jenkins pipelines.

Regression testing time dropped from three days to just a few hours.

This allowed the team to release updates faster without sacrificing quality.

Benefits of Using TestComplete

S. No Benefit Description
1 Faster Automation Record and keyword testing speed up automation
2 Lower Maintenance Smart object recognition reduces broken tests
3 Flexible Scripting Multiple language support
4 DevOps Friendly CI/CD integrations available
5 Enterprise Ready Handles large and complex applications

Best Practices for Using TestComplete

  • Use object mapping – Organize UI elements in a repository for better test stability.
  • Combine keyword and scripted tests – Use keyword tests for simple workflows and scripts for complex scenarios.
  • Implement data-driven testing – Improve test coverage without duplicating scripts.
  • Integrate with CI/CD – Run automation tests during build pipelines.
  • Maintain clear reporting – Use logs and screenshots to quickly identify failures.

Conclusion

TestComplete offers a powerful set of features that make desktop test automation faster, more reliable, and easier to scale. With capabilities like intelligent object recognition, keyword-driven testing, multi-language scripting, and CI/CD integration, it helps QA teams automate complex workflows while reducing manual effort. For organizations that rely heavily on Windows desktop applications, TestComplete provides the flexibility and stability needed to build efficient automation frameworks. When implemented with the right testing strategy, it can significantly improve test coverage, speed up regression cycles, and support faster, high-quality software releases.

Looking to improve your desktop test automation with TestComplete? Our QA experts can help you build scalable automation solutions and enhance testing efficiency.

Contact Our QA Experts

Frequently Asked Questions

  • What are the main TestComplete features?

    The main TestComplete features include intelligent object recognition, keyword-driven testing, record and playback automation, multi-language scripting, data-driven testing, detailed reporting, and CI/CD integration. These features help QA teams automate testing for desktop, web, and mobile applications efficiently.

  • Why are TestComplete features useful for desktop test automation?

    TestComplete features are especially useful for desktop testing because the tool supports Windows technologies such as .NET, WPF, Java, and Delphi. Its object recognition engine allows testers to interact with UI elements reliably, reducing test failures caused by interface changes.

  • Does TestComplete require programming knowledge?

    No, TestComplete does not always require programming skills. One of the most helpful TestComplete features is keyword-driven testing, which allows testers to create automated tests using visual steps without writing code.

  • Which programming languages are supported by TestComplete?

    One of the flexible TestComplete features is its support for multiple scripting languages. Testers can write automation scripts using Python, JavaScript, VBScript, JScript, DelphiScript, C#Script, and C++Script.

  • How do TestComplete features support CI/CD testing?

    TestComplete integrates with popular CI/CD tools such as Jenkins, Azure DevOps, and Git. These TestComplete features allow automated tests to run during build pipelines, helping teams identify issues early in the development process.

  • Is TestComplete better than Selenium for desktop testing?

    For desktop automation, TestComplete is often considered more suitable because Selenium primarily focuses on web testing. The built-in TestComplete features provide stronger support for desktop UI automation and enterprise applications.

TestComplete Remote Desktop: Fix RDP Minimized Test Failures

TestComplete Remote Desktop: Fix RDP Minimized Test Failures

Automation testing helps software teams deliver reliable applications faster. By automating repetitive validation tasks, QA engineers can ensure that applications behave consistently across releases while reducing manual testing effort. However, teams performing TestComplete Remote Desktop testing on remote machines using Remote Desktop Protocol (RDP) often encounter an unexpected problem: automated GUI tests fail when the Remote Desktop session is minimized. This issue frequently affects testers using TestComplete, a powerful automation tool designed for desktop, web, and mobile testing. When running TestComplete automation remotely, engineers may assume that minimizing the Remote Desktop window should not affect the automation process. Unfortunately, Windows behaves differently.

When an RDP session is minimized, Windows automatically stops rendering the graphical interface of the remote machine. This optimization helps reduce resource usage, but it also causes problems for GUI-based automation tools. Since automation frameworks like TestComplete rely on visible UI elements such as buttons, text boxes, menus, and dialog windows, the automation engine can no longer interact with the application interface.

As a result, testers experience issues such as:

  • UI elements not being detected
  • Automated clicks failing
  • Object recognition errors
  • Tests stopping unexpectedly

For QA teams running automation in remote testing environments, CI/CD pipelines, or centralized test labs, this behavior can lead to unreliable test execution and wasted debugging time.

The good news is that this issue has a simple and reliable solution. By applying a small Windows registry tweak on the machine that initiates the Remote Desktop connection, testers can keep the remote GUI active even when the RDP window is minimized.

In this guide, we’ll explain:

  • Why TestComplete Remote Desktop Testing fails when RDP is minimized
  • How Windows handles remote GUI rendering
  • The registry fix that prevents automation failures
  • Best practices for running TestComplete tests on remote machines
  • How to build a stable remote automation environment

By the end of this article, you’ll have a clear understanding of how to run reliable TestComplete automation in Remote Desktop environments without interruptions.

Why TestComplete Remote Desktop Testing Fails When RDP Is Minimized

When automation tests run on a remote machine through Remote Desktop, the graphical interface of the system is transmitted to the client computer.

However, Windows introduces a performance optimization.

When the Remote Desktop window is minimized:

  • Windows assumes the user is not viewing the remote screen
  • The operating system stops rendering the graphical interface
  • The session switches into a GUI-less mode

The application continues running, but the visual interface disappears.

According to the uploaded guide, this behavior occurs because Windows disables the graphical rendering of the remote desktop when the RDP window is minimized.

For everyday users, this optimization is harmless.

But for GUI automation tools like TestComplete, it creates serious problems.

Automation tools rely on visible UI components to:

  • Locate elements
  • Simulate user interactions
  • Validate interface behavior

Without the rendered interface, TestComplete cannot detect UI objects, causing automation failures.

Common Symptoms of the TestComplete RDP Minimized Issue

QA engineers typically encounter the following problems:

  • Tests fail only when Remote Desktop is minimized
  • UI objects cannot be identified
  • Automated clicks do not work
  • Scripts that worked earlier suddenly fail

Here’s a simple breakdown.

S. No Symptom Cause
1 TestComplete cannot find objects Remote GUI not rendered
2 Automation clicks fail Controls are invisible
3 Tests stop unexpectedly UI elements unavailable
4 Tests pass locally but fail remotely RDP session behavior

The Registry Fix for Reliable TestComplete Remote Desktop Testing

Fortunately, there is a reliable workaround.

By modifying a registry setting on the local machine used to connect via Remote Desktop, you can force Windows to keep the remote GUI active even when the RDP window is minimized.

The solution involves adding a DWORD value called RemoteDesktop_SuppressWhenMinimized.

Setting this value to 2 prevents Windows from suppressing the GUI rendering.

This ensures that automation tools like TestComplete continue interacting with UI elements even when the RDP session is minimized.

Step-by-Step Guide to Fix the TestComplete RDP Minimized Issue

Step 1: Open the Windows Registry Editor

Press Windows + R, then type:

regedit

Press Enter to open the Registry Editor.

Step 2: Navigate to the Terminal Server Client Key

Choose one of the following registry paths.

For Current User

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client

For All Users

HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client

Creating DWORD value in Registry Editor for TestComplete Remote Desktop testing fix.

Step 3: Create the Required DWORD Value

Create a new DWORD entry with the following configuration.

  • Name: RemoteDesktop_SuppressWhenMinimized
  • Value: 2

This tells Windows to keep the remote GUI active even when the RDP session is minimized.

Registry fix for TestComplete Remote Desktop testing showing RemoteDesktop_SuppressWhenMinimized value set to 2.

Step 4: Apply the Fix for 64-bit Windows

If your machine uses 64-bit Windows, repeat the same step in:

HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Terminal Server Client

or

HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal Server Client

Add the same DWORD value.

RemoteDesktop_SuppressWhenMinimized = 2

Step 5: Restart the Remote Desktop Session

After updating the registry:

  • Close Registry Editor
  • Disconnect the Remote Desktop session
  • Reconnect to the remote machine

Your TestComplete Remote Desktop Testing environment should now run automation reliably.

Running TestComplete Tests on a Remote Machine

Imagine a QA team running nightly regression tests using TestComplete.

Their environment includes:

  • Dedicated test machine
  • Remote Desktop access
  • Scheduled automation runs

During test execution, an engineer minimizes the Remote Desktop window.

Suddenly:

  • Automation fails
  • TestComplete cannot find UI elements
  • Regression tests stop halfway

After applying the registry fix described earlier, the team can minimize the RDP session without breaking the automation.

Now their automation environment:

  • Runs tests reliably overnight
  • Supports remote monitoring
  • Prevents random automation failures

Benefits of This TestComplete Remote Desktop Testing Fix

S. No Benefit Description
1 Stable automation runs GUI remains visible to automation tools
2 Reliable overnight testing RDP state no longer affects automation
3 Reduced debugging time Prevents mysterious automation failures
4 Better CI/CD compatibility Remote environments stay consistent
5 Improved QA productivity Automation becomes predictable

Best Practices for Running TestComplete Tests on Remote Machines

Use Dedicated Automation Machines

Automation environments should run on machines that are not used for daily development tasks.

This avoids interruptions like:

  • Session logouts
  • Screen locks
  • Unexpected reboots

Avoid Locking the Remote Machine

Locking the screen can also affect GUI rendering.

Ensure the session remains active during automation runs.

Integrate Automation with CI/CD Pipelines

Many QA teams run automation through CI/CD systems such as:

  • Jenkins
  • GitHub Actions
  • Azure DevOps

These systems help automate test execution and reporting.

TestComplete Remote Desktop Testing vs Local Automation

S. No Feature Remote Desktop Testing Local Testing
1 Scalability High Limited
2 Infrastructure Centralized Individual machines
3 Stability Requires configuration Generally stable
4 CI/CD compatibility Excellent Limited
5 Ideal for Large QA teams Individual testers

Final Thoughts

Running GUI automation in Remote Desktop environments can introduce unexpected issues if the system configuration is not optimized for automation tools. One of the most common problems QA teams encounter is the TestComplete RDP minimized issue, where tests fail because the remote graphical interface stops rendering. Fortunately, a simple registry tweak can prevent this behavior and ensure your automation environment remains stable. By keeping the remote GUI active, testers can run automation scripts reliably even when the Remote Desktop session is minimized.

Frequently Asked Questions

  • Why do TestComplete tests fail when the RDP session is minimized?

    Windows disables the graphical rendering of the remote desktop when the RDP window is minimized. GUI automation tools cannot interact with UI elements that are not rendered.

  • Does this problem affect all GUI automation tools?

    Yes. Any automation tool that relies on visible UI components may experience similar issues in Remote Desktop environments.

  • Where should the registry change be applied?

    The registry tweak must be applied on the local machine initiating the Remote Desktop connection, not the remote machine.

  • Can TestComplete run automation on remote machines?

    Yes. TestComplete supports remote execution using tools like TestExecute and integration with CI/CD systems.

  • Is the registry fix safe?

    Yes. The change simply instructs Windows to keep rendering the remote desktop GUI even when minimized.

Best Desktop Application Automation Testing Tools in 2024

Best Desktop Application Automation Testing Tools in 2024

Although web and mobile applications are more widely used now, desktop applications still play an integral role for many organizations. So the need to automate desktop applications for testing purposes is still prevalent and we have many test automation tools in the market as well. Being an expert desktop application automation testing company, we have even developed our very own tool for Desktop App Automation called Gyra. Additionally, we also have strong expertise in the other tools from the market. So we wanted to list the best desktop application automation testing tools available as of 2024 and highlight their features so that you can choose the best tool suitable for your needs.

Types of Desktop Applications & Frameworks

But before heading straight to that, we must understand the different types of Desktop Applications and frameworks. So kindly find the list below

  • Win32 Apps – Applications that are created using WinAPI. These applications are typically native Windows GUI apps.
  • Windows Forms (WinForms) Apps – Applications that are created using frameworks like .NET, Delphi, or MFC instead of calling the Win32 API. WinForms was introduced more than 2 decades ago in the year 2001 with .NET 1.0 framework. As WinForms apps perform well in low-configured machines, it is still being used for its performance and lightweight UI.
  • WPF (Windows Presentation Foundation) Apps – It was released in the year 2006 to modernize Desktop App development as it enables you to create visually rich UI applications. WPF supports cross-platform application development using Avalonia UI. However, WinForms and WPF are still Windows-centric and there is no official statement from Microsoft yet.
  • Universal Windows Platform (UWP) Apps – UWP was introduced with Windows 10. You can run the Desktop apps developed using UWP on Windows Desktop PCs, Windows Mobile, Xbox, and mixed reality headsets.
  • Java AWT (Abstract Window Toolkit) – It is a heavy-weight platform-dependent API used to create Desktop Applications.
  • Java Swing – Swing is a legacy toolkit used to create Desktop Applications using Java.
  • JFX – JFX was introduced along with Java 8 and it can be used to create rich Java-based client applications. JFX supports FXML & CSS.
  • macOS Apps – Used to create Desktop Applications for macOS using Xcode & Swift programming
  • Electron – Electron is a framework that can be used to develop desktop applications using JavaScript, HTML, & CSS.
  • QT – QT is a C++ framework. You can build cross-platform desktop applications with native user interfaces.
  • Best Desktop Application Automation Testing Tools

    Now that we have seen what types of desktop applications and frameworks are out there, let’s take a look at the highlights of all the tools one after another to help you choose the best desktop application automation testing tool in 2024. We’re starting the list with FlaUI.

    FLAUI
    • FlaUI is a .NET library.
    • Supported Apps: You can automate Win32, WinForms, WPF, & UWP applications.
    • Programming Language: C#
    • It uses Microsoft’s UI Automation framework to access the UI elements programmatically.
    • It supports XPath locators for some properties.
    • It has automation support for the QT framework type.
    • It requires a steep learning curve.
    • It does not support Swing & JFX applications.
    • You can’t perform remote execution like how you do it using Selenium RemoteWebDriver
    • Latest version: v4.0.0
    WinAppDriver (Windows Application Driver)
    • It is a popular freeware library used for Desktop Application Automation Testing.
    • Supported Platforms – Windows 10 and Windows Server 2016.
    • Supported Application Types – UWP, WPF, WinForms, and legacy Win32.
    • Prerequisite – You need to enable Developer Mode in Windows Settings before performing execution.
    • You can run scripts on a remote machine.
    • It has its own UI recorder which can generate scripts in C#.
    • You can also attach the already launched application and perform action on it.
    • WinAppDriver Locators – AccessibilityId, ClassName, Id, Name, TagName, & XPath.
    • You can also use Appium’s Windows Driver to send WinAppDriver’s APIs.
    Test Complete
    • It is a well-known commercial tool in the market and it offers two license types (Fixed & Floating).
    • You can automate Win32, WinForms, WPF, Telerik, Electron, Delphi, Qt, Syncfusion apps, etc.
    • Supported Programming Languages – JavaScript, Python, VBScript, JScript, DelphiScript, C#, C++.
    • You can create test scripts in two ways – Keyword Tests and Script Tests.
    • Keyword Tests helps you to create Test Scripts in Table format instead of writing coding. When you record the user actions, Test Complete populates Test Scripts in the Keyword Tests table.
    • Keyword Test is helpful if you are doing POC. But if you are looking to create a robust test suite, go for Script Tests.
    • Another notable feature of Test Complete is you can create BDD tests. If you have your Gherkin feature files in Cucumber Studio, you can easily import them into Test Complete.
    • Latest version 15.65
    Gyra
    • Gyra is Codoid’s Home-grown Desktop Application Automation Testing Tool that is available as a freeware.
    • Supported Programming Language – Java.
    • It is easy to set up as it requires no additional configurations.
    • Execution is fast compared with other tools.
    Ranorex
    • Supported Apps – WinForms, WPF, Qt, Java, Delphi, SAP, UWP, MSAA/UIA, CEF, .NET Core, Office and many more.
    • Supported Programming Languages: C# & VB.NET.
    • Reporting – HTML, PDF, JUnit-compatible reports, & Email.
    • You can analyze GUI objects using the Ranorex spy tool.
    • Latest Version: 11.3.2.
    Squish
    • Supported Programming Languages – Python, Perl, JavaScript, Ruby.
    • Supported Apps – Qt, Swing, AWT, SWT, JFX, macOS, Win32, Winforms, WPF, UWP.
    • Go-to tool to automate QT applications.
    • Latest Release – 7.2.

    Conclusion

    As an automation testing service provider, we understand that desktop app automation is more challenging when compared to web and mobile app automation. Given the additional complexity, choosing the right tool for your automation needs is very important. If you choose the right tool and are able to see success in a Proof of Concept, then you are halfway through. We hope the overview we provided for each desktop application automation testing tool will help you in your decision-making process.

How to Automate a Desktop Application using C#?

How to Automate a Desktop Application using C#?

Despite the rise of people using mobile applications, desktop applications are still being used on a daily basis by many. Though you can test a desktop application manually, it is still important for a tester to know how to automate desktop applications in Windows. There are a few ways to go about it, and in this blog, we will be focusing on how to automate a desktop application using C#. In order to achieve that, we’ll be sharing the tried and tested frameworks, tools, strategies, and approaches we have been using over the years to deliver exceptional automated desktop application testing services to our clients. We’ve also provided an example to help you understand everything clearly. So let’s get started.

.NET Framework

.NET Framework is a software development platform developed by Microsoft to build and run windows applications. .NET is used to automate applications in different operating systems such as Linux, macOS, and Windows. Whereas, .NET framework was developed specifically for Windows. So it can be used to run applications in windows environments that were created using the .NET framework.

WinAppDriver (Windows Application Driver)

WinAppDriver is also a test automation framework developed by Microsoft. It is an open-source option that feels like a combination of a WebDriver and Appium. We say this as WinAppDriver is a set of libraries that can be integrated into a test runner that supports Appium. For those who don’t know, Web drivers are used for desktop application automation and Appium is used for mobile app automation. Before we proceed to see how to automate a Desktop application using C#, let’s take a look at the prerequisites for WinAppDriver

  • Windows 10 OS
  • Visual Studio 2013+
  • WinAppDriver.exe
  • Turn ON Developer mode on the PC

BDD Approach

We have used the BDD approach in numerous automation testing projects and have always been satisfied with the results. That is why we have decided to focus on it while explaining how to automate a desktop application using C#. BDD is expanded as Behavior Driven Development, it is an Agile software development process that allows the design, creation, and product testing, using the product’s behavior.

But the major advantage is that it makes it very easy for even non-technical users to understand the purpose of every test without having to know technical terms like classes, methods, and variables. All the important aspects will be explained using Gherkin language that is in the Given, When, and Then format.

Since we will be automating Notepad in our example, we’ve created a feature file in the Gherkin language for easier understanding.

@Demo 
Scenario: Notepad Demo
 Given Launch Notepad 
 When Enter Specified Text
 Then Verify the Entered Text

Specflow

Now that we have discussed the approach we’ll be using, let’s focus on the Specflow, the solution that can be used to implement BDD in our framework. We can use the Gherkin language as mentioned above and bind the steps definitions for desktop applications. If you haven’t yet installed Specflow, you can easily do so by using the NuGet manager in any Visual Studio project.

@Demo 
Scenario: Notepad Demo
 Given Launch Notepad 
 When Enter Specified Text
 Then Verify the Entered Text

Inspectors

When it comes to web automation, we can find different locators by inspecting the webpage. But that will not be possible when it comes to desktop app automation. That is why knowing how to use a UI Inspector is a crucial part of learning how to automate a desktop application using C#.

Inspectors used for Desktop Applications:

  • FlaUInspect
  • UIspy
  • Inspect
  • VisualUIAVerify

Using either one of these UI inspectors, you’ll be able to see the DOM of the desktop application and get the locators of elements such as ID, Name, ClassName, XPath, and so on.

How to Automate a Desktop Application using C#?

First up, we’ll need to create a new project in Visual Studio using the Console App (.NET Framework)

Create a new project to automate a Dektop application

Install Specflow

We have to then install and set Specflow up by

  • Navigating to Project > Manage NuGet Packages
  • Search for Specflow and click on Specflow to install it
  • We have to then add Specflow.NUnit and Specflow.Tools.MsBuild.Generation from the same NuGet packages

Installing Specflow

Installing WinAppDriver

We need to install WinAppDriver from GitHub to launch and access the desktop application we wish to automate. WinAppDriver will create a bridge for the application and our tests. You’ll have to enable the developer mode in Windows to run WinAppDriver.

To access the WinAppDriver classes and methods, we need to add Appium.Webdriver to our project from NuGet packages

Installing WinAppDriver to automate a desktop Application using C#

The next step would be to Create a Feature file. You can do so by right-clicking on the Feature folder > Add > New item > Search for Feature File for Specflow as shown in the below image.

Creating a feature file in WinAppDriver

Framework Setup

Now that everything is installed and ready, we’ll be seeing how to set up the framework in our How to automate a desktop application using C# blog. You’ll have to,

Create a windowsUtils Class file

Taking screenshots during test execution and generating reports is an integral part of knowing how to automate a desktop application using C#. And you’ll need the windowsUtils class file to achieve that.

public class windowsUtils
    {
        static WindowsDriver<WindowsElement> window;
        static windowsUtils()
        {
         window = LaunchApp("C:\\ProgramData\\Microsoft\\Windows\\Start        Menu\\Programs\\Accessories\\Notepad.lnk");
        }
        public static WindowsDriver<WindowsElement> getWindowInstance()
        {
            return window;
        }
        public static WindowsDriver<WindowsElement> LaunchApp(String _ApplicationLocation)
        {
            try
            {
                AppiumOptions options = new AppiumOptions();
                options.AddAdditionalCapability("app", _ApplicationLocation);
                options.AddAdditionalCapability("deviceName", "WindowsPc");
                window = new WindowsDriver<WindowsElement>(new    Uri("http://127.0.0.1:4723/"), options);

            }
            catch (Exception ex)
            return window;
        }
Create a class file for the Base window

We’ll next have to use WinAppDriver to perform Desktop App Automation testing. So we have mentioned the code you’ll need to use to create the class file for the Base window.

public class baseWindow
    {
        public WindowsDriver<WindowsElement> window;
        public baseWindow(WindowsDriver<WindowsElement> window)
        {
            this.window = window;
        }
        public WindowsDriver<WindowsElement> getWindowInstance(String _ApplicationLocation)
        {
            try
            {
                AppiumOptions options = new AppiumOptions();
                options.AddAdditionalCapability("app", "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Accessories\\Notepad.lnk");
                options.AddAdditionalCapability("deviceName", "WindowsPc");
                window = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723/"), options);
            }
            catch (Exception ex)
            return window;
        }
Create a class file for the Methods

We then create a class for the methods to perform the required action in the desktop application. In our case, we have chosen Notepad. And we will be entering the word “Codoid Innovations” and validating if the specified text has been displayed.

public class Notepad : baseWindow
    {
        static WindowsDriver<WindowsElement> _window;
        public Notepad(WindowsDriver<WindowsElement> window) : base(window)
        {
            _window = this.window; 
        }
        public By Text => By.Name("Text Editor");
        public By Verifyinput => By.Name("Text Editor");
        public void Maximize()
        {
          window.Manage().Window.Maximize();
        }
        public void enterText()
        {
            window.FindElement(Text).SendKeys("Codoid Innovations");
        }
        public bool VerifytheText()
        {
            bool result = window.FindElement(Verifyinput).Displayed;
            return result;
        }
}
Run the Test

Finally, we can run the test by opening the command prompt from the file location and using the following command

“nunit3-console.exe filename –where “cat==tagname from the feature file””

C: \Demo\DemoAutomation\DemoAutomation\bin\Debug>nunit3-console.exe DemoAutomation.dll --where "cat==Demo"

Note: Based on your requirements, you can either add Extent report or Allure report from the nuget packages.

Conclusion

We hope you now have a clear picture of how to automate a desktop application using C# after reading our blog. As a pioneer automation testing company, we have even developed our very own desktop app automation tool called Gyra. If you are unfamiliar with C#, give Gyra a try as it is a free tool that works with Java. We will be publishing more informative content on our website, and we recommend you subscribe to our newsletter to not miss out on any of those content.

Desktop App Automation Testing using Python

Desktop App Automation Testing using Python

In this blog article, you will learn Desktop app automation testing using Python. Automating a desktop app is not an easy task using open-source tools. In the past, we wrote many blog articles on how to automate desktop applications test cases using White Framework.

However, today we would like to show you how to automate a desktop app using Python.

Required Packages

To automate desktop app, we need the following packages (pyWin32, comtypes, & six). Use the below Pip command to install all the three packages.

pip install pywinauto  

Launching An Application

from pywinauto.application import Application
app = Application().start("notepad.exe")
  

Inspecting Elements

You can use anyone of the below listed inspecting tools to write locators.

  • AccEvent.exe
  • AccExplorer32.exe
  • Inspect.exe
  • SPYXX.EXE
  • swapy-ob-0.4.3.exe
  • UISpy.exe
  • ViewWizard.exe
  • WSEdit.EXE

Locating windows by title

app.window(title="Untitled - Notepad").menu_select("Help->About Notepad")
  

Locating with regular expression

app.window(title_re='.* - Notepad$')
  

Finding a window with multiple properties

window = findwindow(title = "Untitled - Notepad", class = "Notepad")

Print Identifiers

Use the below command to print all the identifiers on a window.

app.window(title="Untitled - Notepad").print_control_identifiers()  

Other Actions

app.UntitledNotepad.menu_select("File->SaveAs")
app.SaveAs.ComboBox5.select("UTF-8")
app.SaveAs.edit1.set_text("Example-utf8.txt")
app.SaveAs.Save.click()
  

We explored this library with excitement. Desktop app automation testing using Python library is more user-friendly and the execution is also much faster than other implementations.

How to automate desktop application test cases

How to automate desktop application test cases

Automating desktop app test cases using open source tools is an herculean task. It requires complete understanding of your application’s technology and in-depth knowledge of how your OS interacts with desktop applications. For example: If you are automating a Windows desktop application, you should be aware of how Windows Event-driven programming interacts with your application. In this blog article, we will see most of the technical information based on Windows application.

Technologies for windows desktop app development

Knowing the technologies for Windows desktop app development is a key information to decide a right automation tool. If you take any Windows based desktop application, it must have been developed using the following package/framework Windows API, MFC (Microsoft Foundation Classes), and .NET. When you choose a test automation tool, just check whether these technologies are supported.

How to automate desktop application test cases

How Windows Works

Consider your software under test is developed using Windows API. Each application window is assigned with Window Handle (hwnd). Once the user depresses the left mouse button on the application window, then Windows OS will construct a message and send it to the designated window using hwnd.

Automating Windows Desktop Application

From our experience, we recommend the following libraries (White Framework, FlaUI, .NET UI Automation, and Win32 Library for .net) to automate desktop applications. Choosing a tool is a cakewalk. However, selecting an unique identifier to locate a Windows object is tricky. Automating Desktop application test cases using coordinates is not a good idea. You always need to write robust locators to achieve consistency in automated script execution. Use Object Spy, understand the underlying technology, and perform trail & error method to construct valid object locators.

Automating Windows Desktop Application

In Conclusion:

Don’t automate Desktop Application Test suite without doing a POC. Make sure you engage a test automation architect who has vast experience in automating Desktop, Web, and Mobile applications.