Questions about TDD or Unit Testing in ASP.NET MVC

I was looking for how to do unit testing, and found it to be quite simple, but I want to know that in an asp.net mvc application, what should be REALLY important to check and what methods do you guys use? I just can’t find a clear answer about WHAT IS A TEST when programming unit tests. I just don't want to do unnecessary tests and am wasting development time doing overkill tests.

+3
source share
4 answers

You should unit test as much of your application as possible .

For each line of code you write, you need to make sure that it works. If you are not a unit test, you need to test it in some other way. Even launching a site and clicking around is a kind of testing.

When you compare unit testing with other types of testing (including launching a site and using it manually), unit tests tend to give a better return on investment because they are relatively easy to write and maintain, and they can give you quick feedback on whether you entered a regression error or not.

I'm not saying that there is no overhead when writing unit tests - there is, but there is overhead for any testing and big overhead for not testing at all (because the regression errors slip quite easily).

- , unit test .

+5

: , , .

- - , , - : " , ."

- .

+4

, MVC - . , -, .. , ?

, , - . - , , true.

, ....

As for the submissions, what kind of testing can be done there, except to open the submission and see what it does?

When I write my projects, there is no controller next to the code, and I put all the grunts into my business engine, for which I have extensive tests.

+1
source

Unit testing is useful for testing services / models. But when you need to test the functionality of an application, functional tests (like Selenium) would be the best choice.

0
source

Source: https://habr.com/ru/post/1740078/


All Articles