How to unit test winforms applications

Thanks to the ASP.NET MVC platform, unit test web applications have become possible. But how do you unit test windows form applications?

+4
source share
2 answers

One way is to use the Model View Presenter (MVP) application for Winforms. It’s quite easy to adapt if you have already worked with MVC

In particular, consider the MVC part and cut it as thin as possible so that it is just the skin around the actual components of the user interface and make it completely passive. The controller, now called the master, is responsible for the rest of the system.

Read great articles.

Dan Bunea - Click to Read

Jeremy Miller - Click to Read

Happy coding

+6
source

A typical pattern is the MVP pattern. Testing will be performed against the mocking form.

I also experimented with mock input abstractions and showed forms during testing. It's easy enough to fill in the values ​​on the form until the pop-ups work.

Ultimately, factoring code per unit of measure can be the most appropriate way, and simply using some UI testing infrastructure for the user interface.

0
source

All Articles