MENU

FlaUI : Automate test for windows

I’m interested in automating UI tests for a Windows app developed using WinUI3 in March 2025. Since WinUI3 is a relatively new user interface API, there is less information available compared to more established frameworks like Windows Forms. Consequently, I found it challenging to learn how to automate UI tests for it, and I hope this guide helps others facing a similar situation.

目次

What is FlaUI?

FlaUI is a .NET library that helps with automated UI testing of Windows applications(Win32, WinForms, WPF, Store Apps, …). It is based on the native UI Automation libraries from Microsoft and essentially acts as a wrapper around them. FlaUI wraps almost everything from the UI Automation libraries while also providing access to native objects for cases not yet covered by FlaUI. Some ideas are borrowed from the UIAComWrappter project and TestStack.White but have been rewritten from scratch to maintain a clean codebase.

FlaUI, at Mar 22, 2025

FlaUI leverages the UI Automation frameworks provided by Microsoft, which grant programmatic access to most UI elements on the desktop. It continues to be actively supported-with the latest version released in February 2025, adding support for .NET8, introducing a delay after pressing keyboard modifiers, and more from FlaUI.

It appears to be a useful API for Windows app developers, as evidenced by the several new issues reported by users. Additionally, there are some tutorial videos on YouTube which, although a bit dated, are still quite helpful.

Automate UI!

I developed a very simple app that contains several controls and displays a dialog when the user clicks the submit button.

Test case

Test ConditionPreconditionTest stepsInput DateaExpected Result
To show the result dialog witch includes title and user input values after press submit button.The application is invokedEnter namename = “John Doe”
select ageage = 31 – 40
check isAgreedisAgreed = True
Press submit buttonShow the success dialog(*refer to below table)

Success dialog contents

ParameterValue
TitleSuccess
Message✅ Submission Successful!
📌 Name: {name}
📌 Age: {age}
📌 Agreed: {isAgreed}

Code

I pushed the sample code to my GitHub. If you want to try it, make sure to update the app path so that FlaUI can launch your sample WinUI app.

C#
// UnitTest1.cs
// Arrange
application = FlaUI.Core.APplication.Launch(@"Your app path\App1.exe");

Result

Conclusion

FlaUI has enabled me to automate UI testing for WinUI apps. With continued support as of April 2025 and its growing popularity, I highly recommend trying it if you want to automate UI testing.

Future prospect

  • I want to write code more using FlaUI
  • I want to learn automating know-how like which test case should be or not.
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

コメント

コメントする

目次