While working on some TDDs to work on an ASP.Net MVC project, I came across several scenarios where I wrote tests to ensure that certain actions returned the correct views or had certain attributes ( [ChildActionOnly]
, etc.)., (in fact, I found here some interesting SO posts about useful extension methods to help achieve this).
When I first became acquainted with the concepts of unit testing and TDD, when I was in the course several years ago, the emphasis was on the fact that the tests should focus on the testing logic, the desired functions and functionality - the main requirements of the project if you do this.
My question is if this is so, do the cell checks validate the correct view file to be visualized, or an action that has a specific attribute, etc., that does not really cover the unit testing methodology? Am I writing tests for the wrong reasons (i.e. just protecting myself and other colleagues from refactoring errors) or are these valid cases of valuable unit tests?
harman_kardon
source share