ASP.NET MVC sessions and books say ASP.NET MVC enables to do unit testing as logic would be in controller independent to HTTP Request. So that controller can be unit tested indivisually. I do not think so people write their bussiness logic in controllers
rather in seperate bussiness layer assembly. So there is no need to test controllers in bussiness perspective.
I do not think so we write web applications without a seperate Bussiness Layer. In this case Bussiness Layer also a clear seperation from UI. So
BL can also be tested very well using UNIT testing frameworks either in MVC or in webforms.
then why should we chose ASP.NET MVC over WebForms in terms of UNIT Testing. Could anyone please clarify me in this regard if I'm wrong?
Please Mark as Answer, if it answers you, also correct me if I'm wrong.
You can do UI logic unit testing not Business Logic testing.
You can test what happens when a user clicks a link (calling a controller's action) and even test the result (as you get an ActionResult). You can't do that easily in Web Forms
Please click 'Mark as Answer' if my reply has assisted you
You can test what happens when a user clicks a link (calling a controller's action)
Think of it, once I receive data into Webforms event handler, Only i do is just fill DTO and pass it to Validation Layer. So I can even test UI input validations before calling BL functions.
But testing of UI style and all, I hope these also can not be tested using controllers. as controllers does not know about UI components in MVC. So I did not see any advantage in ASP.NET MVC in terms of UI testing perspective. Could you
please specify any real time example?
raduenuca
and even test the result (as you get an ActionResult). You can't do that easily in Web Forms
Could you please specify any real time example also for this?
Please Mark as Answer, if it answers you, also correct me if I'm wrong.
duttavr
Contributor
4035 Points
1079 Posts
Why MVC best for UNIT test and not webforms if there is BL and Input Validation Layer?
Feb 26, 2011 07:33 PM|LINK
Hi,
ASP.NET MVC sessions and books say ASP.NET MVC enables to do unit testing as logic would be in controller independent to HTTP Request. So that controller can be unit tested indivisually. I do not think so people write their bussiness logic in controllers rather in seperate bussiness layer assembly. So there is no need to test controllers in bussiness perspective.
I do not think so we write web applications without a seperate Bussiness Layer. In this case Bussiness Layer also a clear seperation from UI. So BL can also be tested very well using UNIT testing frameworks either in MVC or in webforms.
then why should we chose ASP.NET MVC over WebForms in terms of UNIT Testing. Could anyone please clarify me in this regard if I'm wrong?
Please Mark as Answer, if it answers you, also correct me if I'm wrong.
raduenuca
All-Star
24675 Points
4250 Posts
Re: Why MVC best for UNIT test and not webforms if there is BL and Input Validation Layer?
Feb 26, 2011 07:51 PM|LINK
You can do UI logic unit testing not Business Logic testing.
You can test what happens when a user clicks a link (calling a controller's action) and even test the result (as you get an ActionResult). You can't do that easily in Web Forms
Radu Enuca | Blog
duttavr
Contributor
4035 Points
1079 Posts
Re: Why MVC best for UNIT test and not webforms if there is BL and Input Validation Layer?
Feb 26, 2011 08:52 PM|LINK
Think of it, once I receive data into Webforms event handler, Only i do is just fill DTO and pass it to Validation Layer. So I can even test UI input validations before calling BL functions.
But testing of UI style and all, I hope these also can not be tested using controllers. as controllers does not know about UI components in MVC. So I did not see any advantage in ASP.NET MVC in terms of UI testing perspective. Could you please specify any real time example?
Could you please specify any real time example also for this?
Please Mark as Answer, if it answers you, also correct me if I'm wrong.
duttavr
Contributor
4035 Points
1079 Posts
Re: Why MVC best for UNIT test and not webforms if there is BL and Input Validation Layer?
Apr 14, 2011 08:43 PM|LINK
I would appreciate if anyone could share some inputs on this please.
Please Mark as Answer, if it answers you, also correct me if I'm wrong.