Is there any way to automate windows forms testing?

后端 未结 7 1176
闹比i
闹比i 2020-12-04 13:15

I am familiar with nunit for unit testing of the business layer however I am looking now to automate the test of the win forms gui layer.

I have seen watin and the

相关标签:
7条回答
  • 2020-12-04 13:35

    As a new alternative, I can give you FlaUI (https://github.com/Roemer/FlaUI). It is basically a complete re-write of white with more features and a clean code-base.

    0 讨论(0)
  • 2020-12-04 13:35

    Here are some links from MSDN Magazine on automatic testing code:

    • Using UIAutomation Bugslayer March 2007
    • Using PowerShell Test Run December 2007
    • Tester, a utility for recording mouse clicks and keystrokes, then playing them back & program checking behaviour. Excellent for unmanaged code. Uses windows handles so may not work well for managed code. Bugslayer March 2002.
    0 讨论(0)
  • 2020-12-04 13:35

    You may consider using Coded UI, a Visual Studio built-in feature and part of the UI Automation:

    Automated tests that drive your application through its user interface (UI) are known as coded UI tests (CUITs). These tests include functional testing of the UI controls. They let you verify that the whole application, including its user interface, is functioning correctly. Coded UI Tests are particularly useful where there is validation or other logic in the user interface, for example in a web page. They are also frequently used to automate an existing manual test.

    [...] a typical development experience might be one where, initially, you simply build your application (F5) and click through the UI controls to verify that things are working correctly. You then might decide to create a coded test so that you don’t need to continue to test the application manually. Depending on the particular functionality being tested in your application, you can write code for either a functional test, or for an integration test that might or might not include testing at the UI level. If you simply want to directly access some business logic, you might code a unit test. However, under certain circumstances, it can be beneficial to include testing of the various UI controls in your application. A coded UI test can automate the initial (F5) scenario, verifying that code churn does not impact the functionality of your application.

    Read more at: https://docs.microsoft.com/en-us/visualstudio/test/use-ui-automation-to-test-your-code

    0 讨论(0)
  • 2020-12-04 13:45

    Check out http://www.codeplex.com/white and http://nunitforms.sourceforge.net/. We've used the White project with success.

    Same Answer to a previous question

    Edit

    The White project has moved, and is now located on GitHub as part of TestStack.

    0 讨论(0)
  • 2020-12-04 13:45

    As far as I know, White is an abstraction layer over the top of Microsoft's UI Automation framework. I have written a similar layer that we use internally on our projects and it works great. So White would definattley be worth a look

    Microsoft have released the source to UI Automation, so if necessary you should be able to debug right down the whole stack if necessary.

    The really cool thing is that with licence cost, you can scale up and run as many machines as you like for execution.

    We run inside VSTS and link our results to requirements, but you can use c# express and nUnit and get first class tools and languages for little to no cost.

    0 讨论(0)
  • 2020-12-04 13:53

    You could check out the Microsoft UI Automation framework. This has been included in .NET since version 3.0. This is actually what the White framework uses anyway.

    0 讨论(0)
提交回复
热议问题