我可以从 Windows From 应用程序运行编码 UI 测试吗?
我可以从 Windows From 应用程序运行编码 UI 测试吗?正在寻找样品。
谢谢。
Can I run Coded-UI Tests from Windows Froms Applications? Looking for a sample.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当然可以 - 您可以使用 mstest.exe 命令行应用程序来运行编码的 UI 测试。您只需要编写简单的算法,确保在启动 mstest 时传递正确的参数。如需参考,请访问此处
Of course you can - you can use mstest.exe command line application for running Coded UI Tests. You just need to write simple algorithm ensuring that correct parameters will be passed while launching mstest. For reference go here
您应该看看 NUnitForms,它是 NUnit 的扩展。
参考此处
You should have a look at NUnitForms that is a extension to NUnit.
Reference here
另请参阅
单元测试 Winforms UI
如何对 winforms 应用程序进行单元测试
单元测试以验证 WinForms 应用程序不不要多次加载 Assembly
基本上,您最好将逻辑与 UI 完全分离,使 UI 尽可能精简,并单独测试逻辑。
see also
Unit testing Winforms UI
How to unit test winforms applications
Unit Test to verify that WinForms application doesn't load Assembly more than once
Basically you will better off separating your logic completely from the UI , making your UI as thin as possible, and testing the logic separately .
您可以在此处找到解决方案控制台应用程序。您必须添加其他引用才能在 Windows 窗体应用程序或其他项目中进行测试(除了本文中列出的引用之外,我还必须添加对 Microsoft.VisualStudio.TestTools.UITest.WindowsStoreUtility 的引用) 。但正如 this so answer 中所解释的,如果您可以在打算使用这些程序集的项目中使用它,那就太好了。
You can find solution here for console application. You have to add additional references in order to work test in windows forms application or other project(I had to add reference to
Microsoft.VisualStudio.TestTools.UITest.WindowsStoreUtility
other than the listed refrences in the article). But as explained in this so answer it would be nice if you can use it in a project that is meant to use these assemblies.