The main thing is to limit GUI testing to a minimum, because this is the most expensive way to test. In the 40 kilogram lines of code, I believe that 90% of the code doesn't work with WinForm GUI elements at all. Thus, most of them can be covered by unit tests, but it depends on how you structure your code.
What to consider:
- SOLID principles, especially the principle of single responsibility (SRP) - instead of several huge classes of βGodβ, you should rely on a large number of small βserviceβ interfaces and classes that do only one thing and do it well, you can write separate tests for them, and then assemble them into a larger picture as soon as you know that they are working fine.
- MVP template (actually passive viewing): WinForm GUI code should only be a thin layer (View), everything else should be in presenters and models.
- Presenter First approach .
I am working on a relatively complex WinForms application , and these templates have never failed me.
As for GUI testing, I use UI Automation , but only for some standard cases. Everything else is covered by testing without using a graphical interface.
source share