Is the View Presenter the right choice to make your asp.net UI verifiable?

I have read a lot of articles about MVP pattern. Some people say it is too difficult and some say it is out of date. However, it seems to me that this is the ideal way to provide a single test access to the UI - this is what I want to achieve.

Have you used MVP, and if so, what do you think?

+1


source to share


2 answers


The View Presenter, Model View Controller, traditional 3-tier interface (UI / Business Logic / Data Storage) or just about any other architecture that isolates the various issues in your code helps you write tests.

Often the architecture is somewhat dictated by your tool: Asp.Net MVP tags seem to indicate that you've already made your choice there. The hardest part to test in any configuration is the UI, because even if you create a mock UI that does all the functions the user can ... at some point you will have to render it in the browser and assure yourself that the theory is sound.



Note that this does not discount the benefits of a mock presenter interface with unit tests that take advantage of all the options the user would have: this makes you brighter years ahead of someone who is testing the interface directly. On the other hand, I have yet to find a program that always renders the user interface the way we would expect in every browser. Finding these cases still requires human intervention (or at best something like Selenium or Test Complete when you have some initial runs).

As for the "obsolete" aspect, I think it is a red herring. Of course, wars of religion are about architectural decisions, but the reason MVP is used in some ASP.NET projects is because there are quite a few people who believed that the traditional ASP.NET stack was too tightly integrated between the user interface and business logic. (I am one of them.) For small projects that are closely related to each other, this is not so important, and also helps to quickly "fine-tune and run" the form designer with data binding. In large projects, the limitations of these tools appear in a hurry, and having a "middle" tier is hacked again after the fact is an issue: you don't have to deal with MVPs.

+6


source


Last year I was using an ASP.NET project using MVP. Yes, I was able to cover more unit testing than I used to in the world of web forms, but it got cracked. Also, try to explain what you are doing to someone else. For some reason, people find it difficult to do this. If I had to do this again, I would go with the ASP.NET MVC framework as it is officially supported by tons of documentation and hype, not just a hack.



+1


source







All Articles