简体   繁体   English

Selenium用于WPF UI自动化测试

[英]Selenium for WPF UI automation testing

我可以使用Selenium进行WPF UI自动化测试吗?

Support for WPF automation exists in WPF itself. WPF本身存在对WPF自动化的支持。 Check out AutomationPeer . 查看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). 如果您想要自动化与UI本身的交互(其有用性是有争议的),这一切都很好。

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. 另一个行动方案是在不触及UI的情况下对业务逻辑进行单元测试 - 如果应用程序使用MVVM,则View和ViewModel之间的松散耦合应该使单元测试变得轻而易举。 I get the impression that you're more into automating the UI though. 我得到的印象是,您更倾向于自动化UI。

Yes, you can use Appium which is based on Selenium. 是的,您可以使用基于Selenium的Appium

There is a pretty good introductory blog post by Scott Hanselman: WinAppDriver - Test any app with Appium's Selenium-like tests on Windows . Scott Hanselman有一篇非常好的介绍性博客文章:WinAppDriver - 在Windows上使用Appium的类似Selenium的测试来测试任何应用程序

You'll need the WinAppDriver that "supports testing Universal Windows Platform (UWP) and Classic Windows (Win32) apps on Windows 10 PCs". 您需要WinAppDriver “支持在Windows 10 PC上测试通用Windows平台(UWP)和经典Windows(Win32)应用程序”。

Selenium can be used to automate only web applications. Selenium可用于仅自动化Web应用程序。 If your WPF is an windows application you can not automate it. 如果您的WPF是Windows应用程序,则无法自动执行。

If you WPF application runs in a web browser using XBAP, still you will not be able to automate the application. 如果您使用XBAP在Web浏览器中运行WPF应用程序,您仍然无法自动化该应用程序。 So the answer is NO. 所以答案是否定的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM