Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium for WPF UI automation testing

Tags:

wpf

selenium

Can I use Selenium to do WPF UI automation testing?

like image 898
Vin Avatar asked Jul 26 '14 10:07

Vin


People also ask

Can we automate UI testing using Selenium?

Using Selenium for testing the UI of your apps When there is a need for automated UI tests, developers tend to use Selenium as it is a great way for automating common interactions a user would perform through a browser over web applications.

Can Selenium test GUI application?

The simple answer is no. Selenium testing is designed to automate web applications, not desktop applications. Automating desktop applications requires a different type of automation tool that's designed for desktop automation.

Does Selenium support .NET applications?

We can use Selenium for . NET applications.


3 Answers

Support for WPF automation exists in WPF itself. Check out AutomationPeer. This article might help. This article is more detailed. All this is good if you want to automate interaction with the UI itself (the usefulness of which is debatable).

Another course of action is to unit test the business logic without touching the UI - if the application uses MVVM then the loose coupling between View and ViewModel should make unit testing a breeze. I get the impression that you're more into automating the UI though.

like image 79
Gigi Avatar answered Sep 19 '22 06:09

Gigi


Yes, you can use Appium which is based on Selenium.

There is a pretty good introductory blog post by Scott Hanselman: WinAppDriver - Test any app with Appium's Selenium-like tests on Windows.

You'll need the WinAppDriver that "supports testing Universal Windows Platform (UWP) and Classic Windows (Win32) apps on Windows 10 PCs".

like image 37
Grzegorz Smulko Avatar answered Sep 19 '22 06:09

Grzegorz Smulko


Selenium can be used to automate only web applications. If your WPF is an windows application you can not automate it.

If you WPF application runs in a web browser using XBAP, still you will not be able to automate the application. So the answer is NO.

like image 45
Purus Avatar answered Sep 20 '22 06:09

Purus