WPF 和 ICUTest 单元测试
您好,我正在评估 ICUTest 在项目中的使用情况。我最初的看法是,它看起来像是一个有前途的可视化测试库。我使用 ICUTest 的场景是启动具有特定配置的应用程序,并且我希望主应用程序窗口根据配置设置显示。每个单元测试都应该启动应用程序,然后在完成后应该正常关闭应用程序。
目前,我可以运行单独的测试,但是当我运行多个测试时,我开始遇到所有类型的线程问题。有人有这方面的经验吗?
Hi I am evaluating ICUTest for use on a project. My initial view is that it looks like a promising Visual testing library. The scenario I have for using ICUTest is to start an application with a specific configuration and I expect the main application window to display based on the configuration settings. Each unit test should start the application and then after completing it should shutdown the application gracefully.
At the moment I can get individual tests to run, but when I run multiple tests I start running into all types of threading issues. Has anyone had any experience with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两种方法可以测试您的应用程序。
1)最简单(也是最可重用)的方法是像测试任何其他窗口一样测试您的主应用程序窗口。在窗口事件(如 Window.Loaded)之后或通过构造函数(例如 new MainWindow("myapp.config") )进行初始化。
2) 如果初始化必须在窗口打开之前完成,那么您可以使用类似于此处。
注意:在WPF中,您只能启动一个应用程序一次,因此方法(1)是更好的选择。
另外,请确保将所有 GUI 相关调用包装在 ICU.Invoke(...) 块中。
There are two ways to test your application.
1) The easiest (and most reusable) way is to just test your main app window like any other window. Do your initialization after a window event (like Window.Loaded) or through the constructor (e.g. new MainWindow("myapp.config") ).
2) If initialization must be done before the window is up then you can start the app thread with code similar to the one here.
Note: in WPF, you can only start an Application once, so method (1) is preferable.
Also, make sure you wrap all your GUI related calls in an ICU.Invoke(...) block.